Question by
Lazybones94 · Jun 02, 2017 at 02:23 PM ·
xcodepostprocess
Configure iCloud capability for XCode Project using XCodeAPI
I am using the following code:
[PostProcessBuild(999)]
public static void AddCapabilities(BuildTarget buildTarget, string pathToBuiltProject)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject proj = new PBXProject ();
proj.ReadFromString (File.ReadAllText (projPath));
string target = proj.TargetGuidByName ("Unity-iPhone");
proj.AddCapability (target, PBXCapabilityType.iCloud);
proj.AddCapability (target, PBXCapabilityType.GameCenter);
proj.AddCapability (target, PBXCapabilityType.InAppPurchase);
File.WriteAllText (projPath, proj.WriteToString ());
}
}
It enables needed capabilities, but it does not configure them. I need to enable settings "key-value storage" and "CloudKit" to true
, but I do not understand how. According to the documentation, it needs some entitelment file, which I do not know where to find and how to change the needed settings in it.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612123339im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
OSX Xcode Project 0 Answers
‚class-internals.' not found Error in Xcode 7 0 Answers
Swift 3 Wrapper needs to embed unity in xcode 8 project 0 Answers