未签名的xcarchive缺少APS环境

3

我想分享未签名的xcarchive。为了创建未签名的xcarchive,我将Provisional配置文件和签名证书设置为None。下面是我逐个执行的命令来创建Xcarchive。

xcodebuild -scheme xxxx -workspace xxx.xcworkspace -configuration Release clean archive -archivePath "/Users/exxx/Desktop/PROD/xxx.xcarchive" CODE_SIGN_ENTITLEMENTS=/Users/exxx/Desktop/PROD/Cert/entitlements.plist CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

在不传递CODE_SIGN_ENTITLEMENTS的情况下使用&

xcodebuild -scheme xxxx -workspace xxx.xcworkspace -configuration Release clean archive -archivePath "/Users/exxx/Desktop/PROD/xxx.xcarchive" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

当我使用组织者上传归档文件时,最终检查会显示授权摘要,其中“aps-environment”密钥总是缺失。附上屏幕截图供参考。两个构建都存在同样的问题。
我也尝试使用授权对相同导出的归档进行签名,但仍然不起作用。(使用以下命令)
codesign --entitlements  /Users/xxx/Desktop/PROD/Cert/xxx.entitlements -f -s xxx /Users/xxx/Desktop/PROD/xxx.xcarchive

上传完成后,我从苹果收到一封电子邮件,内容如下:

您的应用似乎已经注册了苹果推送通知服务,但应用程序签名的授权文件中没有包含“aps-environment”这个授权项目...

enter image description here

1个回答

1
为了将APS权限添加到您的xcarchive中,您应该使用带有aps-environment键(和其他所需键)的entitlements.plist对.app文件进行签名,例如:
<?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>

下一步是使用授权文件签署嵌入式框架和您的应用程序文件:
$ codesign -f -s "<codesiging identity>" -v /foo.xcarchive/Products/Application/foo.app/Frameworks/*
$ codesign -f -s "<codesiging identity>" --entitlements /pathToEntitlements/entitlements.plist /foo.xcarchive/Products/Application/foo.app

要获取可用的代码签名身份,请运行以下命令:
security find-identity -vp codesigning

这正是我一直在寻找的,推送通知已经可以使用了!谢谢!! - Tiago Mendes

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接