当我尝试从jenkins CI Server生成iOS app 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
]
+ /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
答案 0 :(得分:0)
要修复此错误,我必须编辑Apple提供的PackageApplication perl脚本。自从Mavericks以来,资源规则参数已被弃用,但仍然在脚本中使用...它有点hacky但是我找到的唯一方法。
因此,首先备份此脚本,然后对其进行编辑:
(gdb) print myStruct
$1 = {a = 1, b = 2, c = 3}
(gdb) print &myStruct
$2 = (tstructDesc *) 0x600a58 <myStruct>
(gdb) print &myStruct.a
$3 = (int *) 0x600a58 <myStruct>
(gdb) print &myStruct.b
$4 = (int *) 0x600a5c <myStruct+4>
(gdb) print &myStruct.c
$5 = (int *) 0x600a60 <myStruct+8>
替换
/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");
来源:http://www.jayway.com/2015/05/21/fixing-your-ios-build-scripts/