2012-06-26 2 views
0

다음 코드 조각이 있으며 iCloud 디렉토리에 액세스하려고합니다.iCloud 기본 URL이 null

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

    NSString *[email protected]"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.} 
+0

cloudURL을 (를) 사용 하시겠습니까? 그렇다면 NIL 식별자와 관련이있을 수 있습니다. – doge

+0

'nil'대신 컨테이너 식별자를 사용하려고했지만 여전히 동일한 오류가 발생합니다. 그래서 나는 그것이 문제가 아니라고 생각한다. – Amrita

+0

'cloudURL'이 'nil'인 경우 iCould 서비스를 사용할 수 없다는 의미입니다. – holex

답변

1

"컬렉션을 구성 할 수 없습니다."라는 말은 문서 동기화가 어떻게해서 든 사용할 수 없음을 의미합니다.

iCloud에 로그인하셨습니까? 문서 & 데이터를 사용하고 있습니까? cloudURL은 두 가지 이유 중 하나로 인해 문서 동기화가 사용 설정되지 않은 경우 nil이됩니다.

cloudURLnil 인 경우 iCloud를 사용하지 마십시오.

1

기기에서 icloud를 사용하도록 설정 했습니까? this 참조 : 당신은 첫째로 모든 개발자 포털 웹 사이트에 귀하의 응용 프로그램에 대한 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". 
1

.