0

我有以下代码,并正在尝试访问 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.}
4

3 回答 3

1

你确定你在设备上启用了 icloud 吗?参考这个

this is the error that occurs when you haven't enabled iCloud on the device on which you are testing. once i enabled iCloud on the device, the error stopped occurring in my log.

and so now i know what error to check for in order to present the user with a dialog saying "connecting to iCloud won't work until you sign up for iCloud in the system preferences".
于 2012-08-01T10:27:06.587 回答
1

您首先需要在开发者门户网站上为您的应用程序启用 iCloud 支持。

于 2012-10-16T10:19:55.090 回答
1

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

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

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

于 2012-07-24T15:18:56.757 回答