gpt4 book ai didi

ios - iCloud UIDocumentPicker 间歇性崩溃并挂起

转载 作者:技术小花猫 更新时间:2023-10-29 11:03:49 25 4
gpt4 key购买 nike

问题:

从 iCloud 选择文档时,应用程序会随机崩溃,在大多数情况下,以下代码可以正常工作,但在极少数情况下会失败。

我在应用程序中启用了 iCloud 授权,但似乎找不到间歇性失败的原因。有没有我遗失的支票?

它有时也会挂起明显的 5 秒左右(通常在崩溃之前)

代码:

#pragma mark - iCloud =======================================================================================================
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {

BOOL fileUrlAuthozied = [url startAccessingSecurityScopedResource];
NSURL *ubiquityURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
NSLog(@"ubiquityURL - %@",ubiquityURL);

if(fileUrlAuthozied){
NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
NSError *error;

[fileCoordinator coordinateReadingItemAtURL:url options:0 error:&error byAccessor:^(NSURL *newURL) {

NSData *data = [NSData dataWithContentsOfURL:newURL];
//Do something with data
selectedDocumentToUpload = [[UploadDocumentObj alloc] initWithiCloudDocument:data];
[self performSegueWithIdentifier:@"goToRename" sender:nil];

}];
[url stopAccessingSecurityScopedResource];
}else{
//Error handling
[Lib showErrorMessageWithTitle:@"Alert" message:@"E-Sign could not retrive the document!\nPlease try again." delegate:self];

}
}

错误:

2015-03-18 16:22:15.955 E-Sign[6338:1860982] *** Assertion failure in -[UIDocumentPickerViewController _commonInitWithCompletion:], /SourceCache/UIKit/UIKit-3318.93/UIDocumentPickerViewController.m:66
2015-03-18 16:22:15.960 E-Sign[6338:1860982] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?'

其他错误:

2015-03-18 16:33:45.884 E-Sign[6357:1864309] plugin com.apple.UIKit.fileprovider.default interrupted
2015-03-18 16:33:45.885 E-Sign[6357:1864309] plugin com.apple.UIKit.fileprovider.default invalidated

以前有人遇到过这个吗?

最佳答案

我最近遇到了同样的问题:

*** Assertion failure in -[UIDocumentPickerViewController _commonInitWithCompletion:]

是由于缺少App-Capabilities造成的。转到您的构建并选择 Capabilities -> iCloud

通过右侧的开关激活它并打开 iCloud DocumentsCloudKit。 (注意:这仅适用于付费开发者帐户)

重建->运行

还请记住:

iCloud entitlements are available only to apps submitted to the App Store or to the Mac App Store. (Source)

关于ios - iCloud UIDocumentPicker 间歇性崩溃并挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29127537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com