我的自定义键盘应用程序扩展名在我的真实设备上的行为不同,但在我的iOS模拟器上很好。
我在真实设备上收到以下错误
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设备上安装键盘时,将完全访问开关打开。
关于ios - 通过自定义键盘应用扩展程序发出HTTP请求,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42301827/