Building with distribution provisioning profile - unknown error -1=ffffffffffffffff

Hi, 

I’m using 3184 build.

I can build an app for iOS with development provisioning profile without any problem (and install on my local device), however when I try to build the same app with distribution one (in order to send it to Apple Store) I get the ‘code signing failed’ error.

The same thing happens with sample ‘Hello world’ application. 

What could be the reason of this different behavior between profiles (both are active/ green on Apple Developer site and locally in Keychain Access)

ERROR: build command failed: DEVELOPER\_BASE="/Applications/Xcode.app/Contents/Developer" export PATH="$DEVELOPER\_BASE/Platforms/iPhoneOS.platform/Developer/usr/bin:$DEVELOPER\_BASE/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" export CODESIGN\_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign\_allocate" /usr/bin/xattr -cr "/Users/[username]/Documents/HelloWorld.app" && "/usr/bin/codesign" --verbose -f -s "B462C1A63536C37DEDSQW9C57D7C85C88FF929B2" --entitlements "/var/folders/hg/fn8jd2b139gd3wbs038x0mcw0000gp/T/CLtmpKB6sZu/entitlements.xcent" "/Users/[username]/Documents/HelloWorld.app" ERROR: with exit code 1 and output: /Users/[username]/Documents/HelloWorld.app: replacing existing signature Warning: unable to build chain to self-signed root for signer "iPhone Distribution: [username] ([ID])"/Users/[username]/Documents/HelloWorld.app: unknown error -1=ffffffffffffffff BUILD ERROR: ERROR: code signing failed: /Users/[username]/Documents/HelloWorld.app: replacing existing signature Warning: unable to build chain to self-signed root for signer "iPhone Distribution: [username] ([ID])"/Users/[username]/Documents/HelloWorld.app: unknown error -1=ffffffffffffffff

I checked with Engineering, its likely there is a problem with the certificates. It’s easy for expired things to hide in Keychain Access. I would clear everything out of there, and regenerate everything from the beginning.

Rob

It seems that some of certificates in your chain have expired:

> Warning: unable to build chain to self-signed root for signer

This should not be there. Here people solving same issue with starting Xcode, removing all accounts & certs and re-adding them: https://forums.developer.apple.com/thread/86161

From stack overflow:

> I solved my problem by: - Removing all account information from Xcode and quitting Xcode. - Open Keychain Access and delete all my certificates, as well as all Apple root and intermediate certificates. - Manually resintall all Apple root and intermediate certificates. - Relaunch Xcode and open Preferences > Accounts. Sign in to dev account, and select Download Manual Profiles.

I would start with installing this guys:

https://www.apple.com/certificateauthority/

Following those steps AND re-logging to Mac solved the issue, thanks!

I checked with Engineering, its likely there is a problem with the certificates. It’s easy for expired things to hide in Keychain Access. I would clear everything out of there, and regenerate everything from the beginning.

Rob

It seems that some of certificates in your chain have expired:

> Warning: unable to build chain to self-signed root for signer

This should not be there. Here people solving same issue with starting Xcode, removing all accounts & certs and re-adding them: https://forums.developer.apple.com/thread/86161

From stack overflow:

> I solved my problem by: - Removing all account information from Xcode and quitting Xcode. - Open Keychain Access and delete all my certificates, as well as all Apple root and intermediate certificates. - Manually resintall all Apple root and intermediate certificates. - Relaunch Xcode and open Preferences > Accounts. Sign in to dev account, and select Download Manual Profiles.

I would start with installing this guys:

https://www.apple.com/certificateauthority/

Following those steps AND re-logging to Mac solved the issue, thanks!