我的自定义键盘无法共享数据,因为文件协调崩溃(在设备上)

时间:2019-05-10 23:07:07

标签: ios ios-app-extension

虽然这在设备上的Simulator中可以正常工作,但是当我的自定义键盘扩展尝试在包含应用程序编写的共享容器中打开UIDocument时,却无法执行。将以下内容记录到控制台:

tickerB = [{
    baseAsset: 'AUD',
    lastPriceUSD: 0.76,
    volume: 2000
}, {
    baseAsset: 'USD',
    lastPriceUSD: 1.25,
    volume: 1500
}]

报告给UIDocument.handleError(:userInteractionPermitted :)的错误不是很有帮助:

2019-05-10 15:39:09.640305-0700 TagManagerKeyboard[15249:1890026] [claims] 528516A6-B168-43EA-8AAF-B7B1754EE42E grantAccessClaim message failed: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FileCoordination was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.FileCoordination was invalidated.}
2019-05-10 15:39:09.640891-0700 TagManagerKeyboard[15249:1890026] A process invoked one of the -[NSFileCoordinator coordinate...] methods but filecoordinationd crashed. Returning an error.

我在Error Domain=NSCocoaErrorDomain Code=256 "The file “MyFile” couldn’t be opened." UserInfo={NSURL=file:///private/var/mobile/Containers/Shared/AppGroup/3A486D56-F897-4B13-A09F-0B4183686E2C/MyFile} 子类的viewDidLoad()中打开文档:

UIInputViewController

此崩溃发生的可能性为100%。在信息列表中,if let container = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.mycompany.MyApp") { let containerPath = Path(container.path) let file = containerPath + "MyFile" self.doc = MyDocument(fileURL: file.url) debugLog("Extension doc at \(file)") self.doc.open { (inSuccess) in debugLog("Opened doc: \(inSuccess)") NotificationCenter.default.post(name: .dataUpdated, object: nil) } } RequestsOpenAccess。再次,这在模拟器中有效。我也在我拥有的iOS 9.5.3 iPad上进行过尝试,并且出现了类似的崩溃。

为什么会在设备上崩溃?

1 个答案:

答案 0 :(得分:0)

发生这种情况是因为我的键盘没有设置“允许完全访问”。

enter image description here