Hello!
I am trying to incorporate CloudKit into my Mac AppStore build. I was successfully able to make CloudKit work in an iOS app because I had access to XCode. But now I’m building for OSX, and I am running into dead ends, as it seems like no one is even trying to do this at all. So, I’ve made a plugin for Unity with XCode that should include the CloudKit framework and all the functionality that I need to manage the data. However, I have no clue how I can even test CloudKit on my Mac. I can’t test it in Unity; I figure that it absolutely needs the entitlements for CloudKit.
Am I able to test it without having “Use Mac App Store Validation” checked? When I do have it checked, give it entitlements, and build/install a package, opening the app only says that the app is damaged and needs to be reinstalled via the Mac AppStore. Thus, I’m wondering if I need to try wrapping it in entitlements without validation. (I’m gonna try that now)
Does anyone have any other advice on how I should go about actually testing to see if CloudKit works?
Note: I’m using Unity 5.0.1f1 and Mac OSX 10.10
So, some further information:
I’ve tried just doing a non-“Mac App Store Validation” version and tried running it after I code signed it with all the necessary iCloud and CloudKit entitlements. It didn’t work; it crashed with the error “EXC_CRASH (Code Signature Invalid)”. This happens even if I put any one of the iCloud/CloudKit entitlements in; if I don’t have these entitlements in (and just have the basic entitlements Unity needs), then it’ll run.
The iCloud/CloudKit entitlements that I used were exactly the same as the entitlements that are generated automatically in XCode, both for iOS and OSX. Thus, I figure that the entitlements file itself isn’t the actual problem, but maybe the process I’m using for codesigning is incorrect.
Here’s what I’m doing for codesigning using the terminal:
chmod -R a+xr AppName.app
codesign -f -s certificateName AppName.app/Contents/Frameworks/MonoEmbedRuntime/osx/libmono.0.dylib
codesign -f -s certificateName AppName.app/Contents/Frameworks/MonoEmbedRuntime/osx/libMonoPosixHelper.dylib
codesign -f -s certificateName --entitlements AppName.entitlements AppName.app/Contents/Plugins/myCloudKitPlugin.bundle --deep
codesign -f -s certificateName --entitlements AppName.entitlements AppName.app --deep
If I now try to run the app, I get the error I describe above. If I don’t do the last line, then it still runs (although I have no CloudKit access). If I try to use productbuild to make a pkg, it successfully makes a pkg. But when I install the pkg using “sudo installer” or by just installing it as a normal package, it still shows the error. This error will also show if I follow the same procedure with Mac App Store Validation checked.
So, I am confused, and I don’t know what could be causing this at all. Does anyone know anything that I might be able to try?