iOS8 自定义键盘 - 复制 &粘贴到 UIPasteboard [英] iOS8 Custom Keyboard - Copy & Paste to UIPasteboard

查看:26
本文介绍了iOS8 自定义键盘 - 复制 &粘贴到 UIPasteboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在键盘扩展中将文本/图像复制到 UIPasteboard?类似于 popkey.co 处理动画图像.

Is it possible to copy text/image to UIPasteboard in a keyboard extension? Similar to what popkey.co does with animated images.

我测试了下面的代码,它似乎没有工作.

I tested the following code and it doesn't seem to be working.

func copyImage() {
    UIPasteboard.generalPasteboard().string = "copy test"
}

它总是显示这个错误信息:

It always shows this error message:

UIPasteboard - 无法启动 pasteboardd.确保它已安装在 UIKit.framework/Support 中

UIPasteboard - failed to launch pasteboardd. Make sure it's installed in UIKit.framework/Support

您知道从键盘扩展使用复制和粘贴的任何其他方式吗?

Do you know about any other way to use copy&paste from a keyboard extension?

推荐答案

如果我在 Settings->General->Keyboard 应用程序中为我的自定义键盘提供完全访问权限",我就能做到这一点.您需要在 Info.plist 文件中包含 "RequestsOpenAccess" = YES.并且您必须在设置"应用中打开完全访问权限".

I was able to do it if I gave my custom keyboard "Full Access" in the Settings->General->Keyboard app. You need to include "RequestsOpenAccess" = YES in your Info.plist file. AND you have to toggle "Full Access" on in the Settings app.

似乎 Apple 正在限制对一般 UIPasteboard 的访问.

Seems like Apple is restricting access to the general UIPasteboard otherwise.

这篇关于iOS8 自定义键盘 - 复制 &粘贴到 UIPasteboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆