问题
I am working on adding iCloud support to my income tracking app myIncome that is in the Mac App Store as a 1.0 release currently and works as it should in the 1.0 version.
I have only added code to get the ubiquity container and upload the selected file to iCloud. Currently I am using a block to to see if iCloud is even available to validate the menu item that sends the file.
if ([[NSFileManager defaultManager] URLForUbiquityContainerIdentifier: container] == nil) return NO;
return YES;
I have added the keys to the entitlements file and have a development provisioning profile for the app with iCloud active in it.
If code signing is on I get these messages in Console.app and the debugger stops in runtime_init with EXC_BAD_INSTRUCTION
11/4/11 6:52:49.952 PM taskgated: none of the 2 applicable provisioning profile(s) apply
11/4/11 6:52:49.952 PM taskgated: killed com.themikeswan.myIncome[pid 13532] because its use of the com.apple.developer.ubiquity-container-identifiers entitlement is not allowed
If I turn off code signing (and clean the project) I get back nil when I try to get the ubiquity container and Console.app shows these messages:
11/4/11 10:38:03.549 PM librariand: client process 13863 does not have a valid com.apple.developer.ubiquity-container-identifiers entitlement
11/4/11 10:38:03.550 PM librariand: error in handle_container_path_request: LibrarianErrorDomain/9/The client process does not have a valid com.apple.developer.ubiquity-container-identifiers entitlement
I have made a small test app that is a Core Data app and has an iCloud enabled app ID and using the same code everything works so there is clearly something conflicting in myIncome I'm just not sure where to look for the problem.
Has anyone else run into a similar problem or have any ideas where to look?
Once I get iCloud working in myIncome I plan to write up a tutorial for everyone to benefit from this knowledge since there is almost no information on how to add iCloud to a Mac app right now.
回答1:
Turns out the answer is to delete the app's container. ~/Library/Containers/<yourBundleID>
Edit: Here is an image of part of the window showing the full path and some of the containers within it.
来源:https://stackoverflow.com/questions/8017839/issues-with-ubiquity-container-entitlements-and-code-signing-not-playing-nice