0

When i try to generate a iOS app ipa file from jenkins CI Server, i am getting the following error. can you suggest me?

Error Log

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 : []

Checking original app

+ /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
]

Codesigning '' with '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
ElGavilan
  • 6,610
  • 16
  • 27
  • 36
Lakshmi Reddy
  • 313
  • 5
  • 17

1 Answers1

0

To fix this error, I had to edit the PackageApplication perl script provided by Apple. The resource-rules parameter has been deprecated since Mavericks but is still used in the script... It's a bit hacky but the only way I found.

So, first backup this script, then edit it :

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

Replace

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

With

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});
}

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

dqms
  • 303
  • 1
  • 10