Ejemplo n.º 1
0
        // Add the iCloud capability with the desired options.
        public void AddiCloud(bool keyValueStorage, bool iCloudDocument, string[] customContainers)
        {
            var ent = GetOrCreateEntitlementDoc();
            var val = (ent.root[ICloudEntitlements.ContainerIdValue] = new PlistElementArray()) as PlistElementArray;

            if (iCloudDocument)
            {
                val.values.Add(new PlistElementString(ICloudEntitlements.ContainerIdValue));
                var ser = (ent.root[ICloudEntitlements.ServicesKey] = new PlistElementArray()) as PlistElementArray;
                ser.values.Add(new PlistElementString(ICloudEntitlements.ServicesKitValue));
                ser.values.Add(new PlistElementString(ICloudEntitlements.ServicesDocValue));
                var ubiquity = (ent.root[ICloudEntitlements.UbiquityContainerIdKey] = new PlistElementArray()) as PlistElementArray;
                ubiquity.values.Add(new PlistElementString(ICloudEntitlements.UbiquityContainerIdValue));
                for (var i = 0; i < customContainers.Length; i++)
                {
                    ser.values.Add(new PlistElementString(customContainers[i]));
                }
            }

            if (keyValueStorage)
            {
                ent.root[ICloudEntitlements.KeyValueStoreKey] = new PlistElementString(ICloudEntitlements.KeyValueStoreValue);
            }

            project.AddCapability(m_TargetGuid, PBXCapabilityType.iCloud, m_EntitlementFilePath, iCloudDocument);
        }