2

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.

Community
  • 1
  • 1
LumberSzquatch
  • 1,054
  • 3
  • 23
  • 46
  • Deprecated doesn't mean retired and disfunctional. – user3078414 Jul 20 '16 at 19:42
  • show the build script, specifically the build and code sign or packaging you're doing, you'll may need a number of updates to the script rather than just a resource rules change – Wain Jul 25 '16 at 12:30
  • @Wain I'm fairly new to this, and I'm not sure how much I am allowed to show, but I'm adding a censored version of the build and packaging part of the script, the rest is retrieval from our repos and then a push. – LumberSzquatch Jul 25 '16 at 12:54

1 Answers1

2

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"
Wain
  • 118,658
  • 15
  • 128
  • 151
  • 1
    Before I make any changes, may you briefly tell me what this is doing and how you came to this solution? – LumberSzquatch Jul 25 '16 at 15:07
  • it's forcing the provisioning details to use during the build (instead of project settings), it's been in my build scripts for a couple of years i guess, probably longer – Wain Jul 25 '16 at 15:17
  • Just an update (not that you were asking for it) but I'm still trying to get to a point to try your solution, other issues involving this issue occurred. – LumberSzquatch Jul 25 '16 at 19:04
  • Please give details – Wain Jul 25 '16 at 23:21
  • A different Jenkins Job is failing for another reason. I believe from tampering with provisioning profiles before your answer. I'll will be fixing it tomorrow and hopefully try your solution on the script with success. – LumberSzquatch Jul 26 '16 at 01:40
  • Same `Code sign error:` message. Looks like it didn't affect it one way or the other. – LumberSzquatch Jul 26 '16 at 13:56
  • i've had to update my packaging today as Xcode 7 has changed, and that resulted in changing the build to be an archive. I can give you details of this, it's on top of the other changes mentioned above, and i suspect i'll need to see more of your build script to look for other issues / differences... – Wain Aug 05 '16 at 11:46