Monday, August 1, 2016

CodeSign Issues: resource-rules (deprecated in Mac OS X >= 10.10)

Leave a Comment

Firstly, to ease the assumptions of "possible duplicate", I have ran accross these two posts here: Jenkins vs. Xcode plugin - codesign troubles

Xcode 6.1 error while building IPA

And subsequently this apple tech note

These solutions have not solved anything. I recently upgraded a Mac box from a much older OS X to El Capitan along with the latest and greatest XCode version (7.something or other) and is running Jenkins. Projects that were building before the upgrades are now not building.

First error was the one from my title (from first jenkins build after upgrade):

error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign Stuff_I_Dont_think_I_canShow/TheProject.app failed with error 1. Output: Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!.

Tried the solutions from the two posts, pushed the changes, but it failed again with:

Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “SOMEID123” were found. (again, not sure I can show team ID, this stuff is new to me, and I'm not sure what is and what is not sensitive info)

Did some more digging and ran across this answer here: --resource-rules has been deprecated in mac os x >= 10.10. Which cited:

Since Xcode 7, the Code Signing Resource Rules Path build setting must be left empty

Ok. Well I have Xcode 7. So I removed the changes the previous solutions cited and now I get the same error still: Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “SOMEID123” were found.

What's going on here? I have wasted many hours trouble shooting this with no results. Do I have to somehow explicitly remove the usage of resource-rules in some obscure location? Any knowledge sharing would be appreciated.

Here is the packaging and signing part of the script (censored to a degree):

# Build & package app cd $PROJECT_DIR/src/xcode xcodebuild -target MyApp -configuration Release clean build SYMROOT=$BUILD_DIR_BASE xcrun -sdk iphoneos PackageApplication -v $BUILD_DIR/Mobile_MyApp.app -o $BUILD_DIR/Mobile_MyApp.ipa --sign "iPhone Distribution: Company" --embed "$CERT_DIR/hf83uw90-i987-21j0-5t6y-f897e2384957.mobileprovision" 

To add another tidbit of information, this is a git project and before the packaging, retrieval of the project takes place, then access to repos.

1 Answers

Answers 1

So your provision file (PROVISIONFILE) is $CERT_DIR/hf83uw90-i987-21j0-5t6y-f897e2384957.mobileprovision and your distribution name (DISTRIBUTION_NAME) is iPhone Distribution: Company.

I'd add this to the script:

PROFILE_UUID=`grep "<key>UUID</key>" $PROVISIONFILE -A 1 --binary-files=text | sed -E -e "/<key>/ d" -e "s/(^.*<string>)//" -e "s/(<.*)//"` 

and then on the xcodebuild line

PROVISIONING_PROFILE=$PROFILE_UUID CODE_SIGN_IDENTITY="$DISTRIBUTION_NAME" 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment