2014-10-31 1 views
0

Xcode 5에서 Xcode 6으로 변경되고 iCloud 관리 시스템에서 온라인으로 변경 되었기 때문에 iCloud의 키 - 값 저장소에 데이터를 저장하는 기능이 손실되었습니다. 보다 구체적으로는, 지금, 모두 :키 - 값 저장을 위해 iCloud의 기본 컨테이너가 작동하지 않습니다.

[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; 

지금

[NSFileManager defaultManager].ubiquityIdentityToken 

모두 반환 전무

. 이전에는 (적어도) URLForUbiquityContainerIdentifier가 nil이 아닌 값을 반환했습니다.

여기에 주어진 답변은 Why ubiquityIdentityToken returns nil?이고 여기서는 https://devforums.apple.com/thread/229509이지만 기쁨은 없었습니다.

답변

1

나는 이것에 대한 해결책을 발견했다. 먼저 iOS6을 타겟으로하는 Xcode 6 샘플 프로젝트를 시도했습니다 (iOS6 호환성을 유지해야합니다). 그것은 기본 컨테이너 설정처럼 보인다

enter image description here

그냥 키 - 값 저장 작동하지 않습니다 : 나는 기능에서 이러한 설정을했다. 즉, 위와 같이 설정하면 ubiquityIdentityToken은 nil을 반환합니다.

다음으로 CloudKit 상자를 확인한 다음 사용자 지정 컨테이너를 지정하려고했습니다. 그건 내 IOS6 호환성 문제를 제외하고 일했을 수도 있습니다. iOS6에서는 CloudKit가 작동하지 않습니다.

나는 그 아이 클라우드 문서 상자 체크 시도) (해킹 위대 내 길을?) :

enter image description here

이것은 ubiquityIdentityToken 비 전무를 반환됩니다! 이 테스트 응용 프로그램과 달리 실제 응용 프로그램에서이 변경 사항을 적용하면 키 - 값 저장이 다시 작동합니다! (iOS8.1에서도 작동합니다). 내 자격 파일의

관련 부분은 지금 :

<key>com.apple.developer.icloud-container-identifiers</key> 
<array> 
    <string>iCloud.$(CFBundleIdentifier)</string> 
</array> 
<key>com.apple.developer.icloud-services</key> 
<array> 
    <string>CloudDocuments</string> 
</array> 
<key>com.apple.developer.ubiquity-container-identifiers</key> 
<array> 
    <string>iCloud.$(CFBundleIdentifier)</string> 
</array> 
<key>com.apple.developer.ubiquity-kvstore-identifier</key> 
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string> 
관련 문제