PackageApplication stopped working with OS X 10.10 (Yosemite) today
Asked Answered
S

2

7

UPDATE: The correct answer is probably this one: Xcode 6.1 error while building IPA

Using Jenkins to build iOS projects from repositories since a few years. Suddenly today a new error occurs, stopping builds.

I think I based most of this setup on this tutorial way back:

http://www.raywenderlich.com/22816/beginning-automated-testing-with-xcode-part-22

This step causes the error:

# 4
echo "*** Post build step 4"
/usr/bin/xcrun -sdk iphoneos PackageApplication \
-o "${IPA_DIR}/${PROJECT}.ipa" \
-verbose "${APP}" \
-sign "${SIGNING_IDENTITY}" \
--embed "${PROVISIONING_PROFILE}"

It's a bit tricky to look at the logs where the error occurs, but here it is:

### Codesigning '/Users/Shared/Jenkins/Home/jobs/myapp/workspace/myapp_adhoc_7.mobileprovision' with 'iPhone Distribution: mycompany Inc.'
+ /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign iPhone Distribution: mycompany Inc. --resource-rules=/var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.app/ResourceRules.plist --entitlements /var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/entitlements_plistYdluSmqT /var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.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/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.app/ResourceRules.plist: cannot read resources
]
error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign iPhone Distribution: mycompany Inc. --resource-rules=/var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.app/ResourceRules.plist --entitlements /var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/entitlements_plistYdluSmqT /var/folders/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.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/y1/4hrpc2851b7dxn9bhlkhbrnr00007q/T/ipIxOjxE2z/Payload/myapp.app/ResourceRules.plist: cannot read resources

I'll try to fix this myself and later add the solution here, but in case anyone is faster than me please go ahead.

  • I have not specified --resource-rules in any settings. I guess xcrun uses this setting on its own, even though it is deprecated.
Sosanna answered 22/10, 2014 at 4:55 Comment(0)
S
8

Found the answer.

The problem that occurred now was the "xcrun PackageApplication" something something line. I had to remove the "-sign some profile" parameter, then things started working again.

That said I don't know why signing was necessary before, and why it isn't now so can't tell if this is going to cause some problem later.

Sosanna answered 22/10, 2014 at 5:18 Comment(5)
Simply remove signing isn't a good idea if you distribute your app. Your xcrun PackageApplication fails due to the deprecated parameter --resource-rules used by xcrun. Apple made that obsolete a while ago but didn't update xcrun to simply omit that. That's the reason why from here on codesigning simply fails if the ResourceRules.plist isn't thereHappening
So what do you suggest, do you have a better answer?Sosanna
This: https://mcmap.net/q/165565/-how-to-fix-xcode-6-1-error-while-building-ipa has a lot of upvotes, it might be correct.Sosanna
Indeed #26498363 is the "correct" answer, at least it worked for me, and a ton of other people...Sosanna
stackoverflow.com/questions/26497863/... worked for me as well. Thanks!Vaccinia
J
11

Instead of using xcrun, you can use xcodebuild to create an archive and then run xcodebuild again to create the IPA file.

# Create an archive
xcodebuild -alltargets -configuration "${CONFIGURATION}" -scheme "${SCHEME}" -archivePath "${APP_PATH}/${PROJECT}.xcarchive" archive

# Create the IPA file from the archive
xcodebuild -exportProvisioningProfile "${PROVISIONING_PROFILE_NAME}" -exportArchive -exportFormat IPA -archivePath "${APP_PATH}/${PROJECT}.xcarchive" -exportPath "${IPA_DIR}/${PROJECT}.ipa" CODE_SIGN_IDENTITY="${SIGNING_IDENTITY}"

Note that ${PROVISIONING_PROFILE_NAME} should contain the name of the provisional profile, and not the path to the file itself.

Jube answered 11/6, 2015 at 10:20 Comment(0)
S
8

Found the answer.

The problem that occurred now was the "xcrun PackageApplication" something something line. I had to remove the "-sign some profile" parameter, then things started working again.

That said I don't know why signing was necessary before, and why it isn't now so can't tell if this is going to cause some problem later.

Sosanna answered 22/10, 2014 at 5:18 Comment(5)
Simply remove signing isn't a good idea if you distribute your app. Your xcrun PackageApplication fails due to the deprecated parameter --resource-rules used by xcrun. Apple made that obsolete a while ago but didn't update xcrun to simply omit that. That's the reason why from here on codesigning simply fails if the ResourceRules.plist isn't thereHappening
So what do you suggest, do you have a better answer?Sosanna
This: https://mcmap.net/q/165565/-how-to-fix-xcode-6-1-error-while-building-ipa has a lot of upvotes, it might be correct.Sosanna
Indeed #26498363 is the "correct" answer, at least it worked for me, and a ton of other people...Sosanna
stackoverflow.com/questions/26497863/... worked for me as well. Thanks!Vaccinia

© 2022 - 2024 — McMap. All rights reserved.