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

查看:340
本文介绍了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测试了以下代码,它似乎没有工作。

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 - 无法启动粘贴板。确保它安装在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?

推荐答案

如果我在设置 - >常规 - >键盘中给我的自定义键盘完全访问,我就能做到这一点应用程序。
您需要在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天全站免登陆