在Unity的Editor的目录下,创建文件
Base.entitlements 文件内容
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
添加代码
string entitlement = Application.dataPath+ "/Editor/Entitlement/Base.entitlements";
File.Copy(entitlement, path+"/Unity-iPhone/Base.entitlements");
bool result=project.AddCapability (targetGUID, PBXCapabilityType.PushNotifications,"Unity-iPhone/Base.entitlements",true);
Debug.Log("添加推送:"+result);