从自定义键盘应用程序扩展中制作HTTP请求
问题描述:
我的自定义键盘应用程序扩展在我的真实设备上运行方式不同,但在我的iOS模拟器上运行良好。从自定义键盘应用程序扩展中制作HTTP请求
我让我的真实设备
2017-02-17 16:30:01.369868 Custom Keyboard[8472:570942] [default] error registring notify port: (1000000)
2017-02-17 16:30:01.371652 Custom Keyboard[8472:570889] [Common] BKSAccelerometer unable to create notifyd token for device orientation
2017-02-17 16:30:01.702241 Custom Keyboard[8472:570940] [] __nwlog_err_simulate_crash_libsystem libsystem simulate crash failed "libsystem_network.dylib: networkd_settings_setup_notify_watch :: notify_register_dispatch(com.apple.system.networkd.settings) [status 1000000] failed"
2017-02-17 16:30:01.706023 Custom Keyboard[8472:570940] [] networkd_settings_setup_notify_watch notify_register_dispatch(com.apple.system.networkd.settings) [status 1000000] failed, dumping backtrace:
以下错误和我使用标准Alamofire代码:
Alamofire.request("https://httpbin.org/get").response { response in
print("Request: \(response.request)")
print("Response: \(response.response)")
print("Error: \(response.error)")
if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
print("Data: \(utf8Text)")
}
}
我真的不明白是怎么回事。
任何帮助表示赞赏。提前致谢。
答
您需要具有完全访问权限才能启用自定义键盘网络。
转到Info.plist,查看NSExtensionAttributes并将RequestsOpenAccess更改为YES。
然后,当在iOS设备上安装键盘时,将全部访问开关打开。
只要我这样做,并从我的KeyboardViewController(UIInputViewController的子类)的viewDidLoad()发出请求....我的键盘停止切换。它再也不会出现,无论我做什么......我重置模拟器并尝试......但没有运气......你能帮忙吗? – iAnurag
对不起,自从我一直致力于此工作已经过了很多年了,我不记得任何重要的东西。 –
没问题....我已经得到了答案.. !!! – iAnurag