0

当我尝试从 jenkins CI 服务器生成 iOS 应用程序 ipa 文件时,出现以下错误。你能建议我吗?

错误日志

Output directory: '/Users/Username/.jenkins/workspace/JobName/build/appname.ipa'
Temporary Directory: '/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A'  (will NOT be deleted on exit when verbose set)
+ /bin/cp -Rp /Users/Username/.jenkins/workspace/JobName/build/appname.app /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload
Program /bin/cp returned 0 : []

检查原始应用程序

+ /usr/bin/codesign --verify -vvvv /Users/Username/.jenkins/workspace/JobName/build/appname.app
Program /usr/bin/codesign returned 0 : [/Users/Username/.jenkins/workspace/JobName/build/appname.app: valid on disk
/Users/Username/.jenkins/workspace/JobName/build/appname.app: satisfies its Designated Requirement
]
Done checking the original app
+ /usr/bin/codesign -d --entitlements /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_rawrb2JgSwk /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app
Program /usr/bin/codesign returned 0 : [Executable=/private/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app/appname
]
+ /usr/libexec/PlistBuddy -c Set :get-task-allow NO /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_plistsdXXqkO6
Program /usr/libexec/PlistBuddy returned 0 : []
+ /usr/bin/plutil -lint /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_plistsdXXqkO6
Program /usr/bin/plutil returned 0 : [/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_plistsdXXqkO6: OK
]

使用 'iPhone Distribution:Dist cert name' 对 '' 进行代码设计

+ /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign iPhone Distribution:Dist cert name --resource-rules=/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app/ResourceRules.plist --entitlements /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_plistsdXXqkO6 /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app
Program /usr/bin/codesign returned 1 : [Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app/ResourceRules.plist: cannot read resources
]
error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign iPhone Distribution:Dist cert name --resource-rules=/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app/ResourceRules.plist --entitlements /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/entitlements_plistsdXXqkO6 /var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app failed with error 1. Output: Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
/var/folders/74/t1j47pm914jbphlv2htlhx4mwl864h/T/S8Iquejn1A/Payload/appname.app/ResourceRules.plist: cannot read resources

Failed to build /Users/Username/.jenkins/workspace/JobName/build/appname.ipa
Build step 'Xcode' marked build as failure
4

1 回答 1

0

为了修复这个错误,我不得不编辑 Apple 提供的 PackageApplication perl 脚本。自 Mavericks 以来,resource-rules 参数已被弃用,但仍在脚本中使用......这有点 hacky,但我发现的唯一方法。

所以,首先备份这个脚本,然后编辑它:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication

代替

my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements,resource-rules",
                      "--sign", $opt{sign},
                      “--resource-rules=$destApp/ResourceRules.plist");

my @codesign_args;
if (-e '$destApp/ResourceRules.plist') {  # If ResourceRules.plist exists, include it in codesign arguments, for backwards compatability
    @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements,resource-rules",
                     "--sign", $opt{sign},
                     "--resource-rules=$destApp/ResourceRules.plist");
} else { # If ResourceRules.plist isn't found, don't include it in the codesign arguments
    @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements",
                     "--sign", $opt{sign});
}

来源:http ://www.jayway.com/2015/05/21/fixing-your-ios-build-scripts/

于 2015-11-12T14:23:04.800 回答