in Facebook.Unity.Editor/iOS/PBXProject.cs [511:565]
public bool AddCapability(
string targetGuid,
PBXCapabilityType capability,
string entitlementsFilePath = null,
bool addOptionalFramework = false
)
{
// If the capability requires entitlements then you have to provide the name of it or we don't add the capability.
if (capability.requiresEntitlements && entitlementsFilePath == "")
{
throw new Exception(
"Couldn't add the Xcode Capability "
+ capability.id
+ " to the PBXProject file because this capability requires an entitlement file."
);
}
var p = project.project;
// If an entitlement with a different name was added for another capability
// we don't add this capacity.
if (p.entitlementsFile != null && entitlementsFilePath != null && p.entitlementsFile != entitlementsFilePath)
{
if (p.capabilities.Count > 0)
throw new WarningException(
"Attention, it seems that you have multiple entitlements file. Only one will be added the Project : "
+ p.entitlementsFile
);
return false;
}
// Add the capability only if it doesn't already exist.
if (p.capabilities.Contains(new PBXCapabilityType.TargetCapabilityPair(targetGuid, capability)))
{
throw new WarningException("This capability has already been added. Method ignored");
}
p.capabilities.Add(new PBXCapabilityType.TargetCapabilityPair(targetGuid, capability));
// Add the required framework.
if (capability.framework != "" && !capability.optionalFramework ||
(capability.framework != "" && capability.optionalFramework && addOptionalFramework))
{
AddFrameworkToProject(targetGuid, capability.framework, false);
}
// Finally add the entitlement code signing if it wasn't added before.
if (entitlementsFilePath != null && p.entitlementsFile == null)
{
p.entitlementsFile = entitlementsFilePath;
AddFileImpl(entitlementsFilePath, entitlementsFilePath, PBXSourceTree.Source, false);
SetBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", PBXPath.FixSlashes(entitlementsFilePath));
}
return true;
}