iOS8 Custom Keyboard - Copy amp; Paste to UIPasteboard(iOS8 自定义键盘 - 复制 amp;粘贴到 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS8 自定义键盘 - 复制 &粘贴到 UIPasteboard


基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01