iphone - iCloud 基本 URL 为空

标签 iphone ios ipad url icloud

我有以下代码,正在尝试访问 iCloud 目录。

(void) reloadFiles{
    NSFileManager *fileManager = [NSFileManager defaultManager]; 

    NSString *containerID=@"KSC75JA957.Dcdmc.TinyPix";

    NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];

    NSLog(@"got cloudURL %@", cloudURL); 

    self.query = [[NSMetadataQuery alloc] init];

    query.predicate = [NSPredicate predicateWithFormat:@"%K like '*.tinypix'", NSMetadataItemFSNameKey];

    query.searchScopes = [NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope];

    [query startQuery];                       
}

但是,当我运行我的应用程序时,我无法获取云 URL。并且出现以下错误。

 got cloudURL (null)

 item update error: 0, Error

 Domain=LibrarianErrorDomain Code=10 "The operation couldn’t be completed. 

(LibrarianErrorDomain error 10 - Unable to configure the collection.)"

 UserInfo=0xce65470 {NSDescription=Unable to configure the collection.}

最佳答案

“无法配置集合”意味着文档同步以某种方式被禁用。

您是否已登录 iCloud 并启用了文档和数据? 如果由于这两个原因之一未启用文档同步,cloudURL 将为 nil

如果 cloudURLnil,您不应尝试使用 iCloud。

关于iphone - iCloud 基本 URL 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11207213/

相关文章:

iphone - 可以在iOS 5 ipad编程中使用google Maps街景 带标注等mapkit的功能吗?

iphone - kCFNull 和 [NSNull null] 是否可以互换

ios - 在 block 中分配NSString变量时出错

ios - 不执行静态 TableView Swift 中 cellForRowAtIndexPath 中的 if 语句

iphone - 如何将scrollViewWillBeginDragging限制为仅一个发送者对象?

iphone - 如何设置自定义规则,例如 GameCenter 寻找比赛的难度级别

iphone - 两个 UIWebView,如何设置第二个 webview,以便在单击链接时将它们发送到第一个 webview 进行加载?

ios - UIView 中的 UITableView

ios - SpriteKit 加载新场景但 Sprite 立即掉落

html - iPad、Safari、CSS : Fill page with flex