I will show you how to include iOS’s entitlements file in a Unity project and how to hand it over to Xcode project.
I did this research out of my own need.
I’m using this to automatically add “Associated Domains” to the generated Xcode project.
Like you and many other Unity users, I was somewhat confident in Unity’s ability to handle complex things.
So I tried putting a file which has .entitlements as it’s extension in a project
just to find out disappointing result that It has no effect.
Then I searched and scouted around for an easy aid for hours but with no success.
Only thing I could do was to create a script I need by myself.
Usage:
Import EntitlementsPostProcess.unitypackage.
Inside Xcode trim Capabilities and let Xcode create an entitlements file.
Copy the entitlements file created into Unity project.
Hook up your entitlements file within the inspector view of EntitlementsPostProcess.cs
Links to documents:
Tested with Unity 5.3.5f1 and Xcode 8.1
It should work with Unity 5.4 too.
Great answer and solved my problem on enabling iCloud automactically!
Now I am wondering how can I enable IAP and GameCenter by default too? Since they doesn’t need entitlement file? (Now I still need to manually turn these 2 on)
As I consider this thread to consist of notions which are already a bit hard to understand,
I feel like mixing up no further complexity.
Therefore, @SweatyChair , I suggest you to create a new thread.
I am certain that your problem here will be treated in a totally different way.
I tried the instructions shared here by a_p_u_r_o; however when i upload the IPA file generated by cloud build via application loader i get several errors due to ERROR ITMS-90045 Invalid Code Signing Entitlements" on several keys e.g. UILuanchStoryBoardName, UIApplicationExitOnSuspend etc. Any suggestions? Thanks
One thing though: on my local setup, I found that the script would fail when appending to an existing project since the entitlements file was already there. Easy fix was to just delete it first:
Thats GREAT!
But, how can I get this .entitlements file? I opened the XCode and configure the capabilities, but the .entitlements file do not changed and just have this content.
I don’t get the solution in that thread, it was closed and it seems likely people need to manually set up IAP and Game center flag inside xcode project rather writing postbuild ios.
I also tried this https://bitbucket.org/snippets/Eyeoness/eaong . However, it just doesn’t work. Unity shows log successfully writing the SystemCapabilities, however, when open file pbxproj, nothing changes. It seems likely somewhere overwrite my method.
Any advise to enable IAP and Game Center via post build process Unity ios.