Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

Code signing fails for Enterprise distribution #90

Closed
djtarazona opened this issue Sep 20, 2015 · 80 comments
Closed

Code signing fails for Enterprise distribution #90

djtarazona opened this issue Sep 20, 2015 · 80 comments
Labels

Comments

@djtarazona
Copy link

I'm not sure what happened or at what gym version this broke in, but building for Enterprise distribution now fails when using gym with fastlane.

[20:27:35]: Successfully stored the archive. You can find it in the Xcode Organizer.
[20:27:35]: You're using Xcode 7, the `provisioning_profile_path` value will be ignored
[20:27:35]: Please follow the Code Signing Guide: https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md
[20:27:35]: /usr/bin/xcrun xcodebuild -exportArchive -exportOptionsPlist '/tmp/gym_config_1442719655.plist' -archivePath '/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive' -exportPath '/tmp/1442719655' 
2015-09-19 20:27:35.795 xcodebuild[49814:7224280] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/yc/hkdr9bt97nvfshd494n3lm940000gn/T/Welkio_2015-09-19_20-27-35.795.xcdistributionlogs'.
2015-09-19 20:27:36.345 xcodebuild[49814:7224280] [MT] IDEDistribution: -[IDEDistributionProvisioning _itemToSigningInfoMap:]: Can't find any applicable signing identities for items: (
"<IDEDistributionItem: 0x7fdbcea25e60 'com.wearehathway.welkio.beta' '<DVTFilePath:0x7fdbcc7607f0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app'>'>",
"<IDEDistributionItem: 0x7fdbcea1ee40 'org.cocoapods.Alamofire' '<DVTFilePath:0x7fdbcc76ed10:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/Alamofire.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea1db80 'org.cocoapods.Cartography' '<DVTFilePath:0x7fdbce884a20:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/Cartography.framework'>'>",
"<IDEDistributionItem: 0x7fdbce9331d0 'org.cocoapods.CocoaLumberjack' '<DVTFilePath:0x7fdbce88a970:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/CocoaLumberjack.framework'>'>",
"<IDEDistributionItem: 0x7fdbcc697b90 'org.cocoapods.KeychainAccess' '<DVTFilePath:0x7fdbce890870:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/KeychainAccess.framework'>'>",
"<IDEDistributionItem: 0x7fdbcc687eb0 'org.cocoapods.LogEntries' '<DVTFilePath:0x7fdbce8aaa00:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/LogEntries.framework'>'>",
"<IDEDistributionItem: 0x7fdbce92d110 'org.cocoapods.MMMarkdown' '<DVTFilePath:0x7fdbcc774ac0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/MMMarkdown.framework'>'>",
"<IDEDistributionItem: 0x7fdbce92cf20 'org.cocoapods.OMGHTTPURLRQ' '<DVTFilePath:0x7fdbce8a2c00:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/OMGHTTPURLRQ.framework'>'>",
"<IDEDistributionItem: 0x7fdbcc68fcb0 'org.cocoapods.PromiseKit' '<DVTFilePath:0x7fdbce8b61a0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/PromiseKit.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea0c680 'org.cocoapods.Pusher' '<DVTFilePath:0x7fdbce8bbe40:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/Pusher.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea23990 'org.cocoapods.SDWebImage' '<DVTFilePath:0x7fdbce8c16a0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/SDWebImage.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea10780 'org.cocoapods.SocketRocket' '<DVTFilePath:0x7fdbce8c7450:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/SocketRocket.framework'>'>",
"<IDEDistributionItem: 0x7fdbcc68be70 'org.cocoapods.Spring' '<DVTFilePath:0x7fdbcc672100:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/Spring.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea27b90 'org.cocoapods.Toucan' '<DVTFilePath:0x7fdbce8cfad0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/Toucan.framework'>'>",
"<IDEDistributionItem: 0x7fdbce92ab70 'org.cocoapods.UIResponder-KeyboardCache' '<DVTFilePath:0x7fdbcc674e90:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/UIResponder_KeyboardCache.framework'>'>",
"<IDEDistributionItem: 0x7fdbcea127d0 'org.cocoapods.libPhoneNumber-iOS' '<DVTFilePath:0x7fdbce8967d0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libPhoneNumber_iOS.framework'>'>",
"<IDEDistributionItem: 0x7fdbcc682cb0 'com.apple.dt.runtime.swiftAVFoundation' '<DVTFilePath:0x7fdbce899510:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftAVFoundation.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc68b080 'com.apple.dt.runtime.swiftCore' '<DVTFilePath:0x7fdbce89a290:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftCore.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc685380 'com.apple.dt.runtime.swiftCoreAudio' '<DVTFilePath:0x7fdbce8962d0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftCoreAudio.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc694280 'com.apple.dt.runtime.swiftCoreGraphics' '<DVTFilePath:0x7fdbce89d330:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftCoreGraphics.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcea0d5a0 'com.apple.dt.runtime.swiftCoreImage' '<DVTFilePath:0x7fdbce89eb50:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftCoreImage.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc777bd0 'com.apple.dt.runtime.swiftCoreMedia' '<DVTFilePath:0x7fdbce89fdb0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftCoreMedia.dylib'>'>",
"<IDEDistributionItem: 0x7fdbce92f910 'com.apple.dt.runtime.swiftDarwin' '<DVTFilePath:0x7fdbce8a1310:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftDarwin.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc777060 'com.apple.dt.runtime.swiftDispatch' '<DVTFilePath:0x7fdbce89c290:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftDispatch.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc77ebf0 'com.apple.dt.runtime.swiftFoundation' '<DVTFilePath:0x7fdbce8a3e50:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftFoundation.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc689e80 'com.apple.dt.runtime.swiftGLKit' '<DVTFilePath:0x7fdbce8a53b0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftGLKit.dylib'>'>",
"<IDEDistributionItem: 0x7fdbce92fce0 'com.apple.dt.runtime.swiftObjectiveC' '<DVTFilePath:0x7fdbce8a6b20:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftObjectiveC.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcea28f60 'com.apple.dt.runtime.swiftUIKit' '<DVTFilePath:0x7fdbce8a9570:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftUIKit.dylib'>'>",
"<IDEDistributionItem: 0x7fdbcc699190 'com.apple.dt.runtime.swiftsimd' '<DVTFilePath:0x7fdbce8a8120:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app/Frameworks/libswiftsimd.dylib'>'>"
)
Errors={
"<DVTSigningCertificate: 0x7fdbc9f8dfb0; name='iPhone Distribution: Hathway Technology Group LLC', hash='3283D4CF4D60D2515D80D0AFAEA55325E9DE8B81', certificateKind='1.2.840.113635.100.6.1.4'>" =     {
"<IDEDistributionItem: 0x7fdbcea25e60 'com.wearehathway.welkio.beta' '<DVTFilePath:0x7fdbcc7607f0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app'>'>" = "Error Domain=DVTCodesignResolverErrorDomain Code=7 \"No matching provisioning profiles found\" UserInfo={NSLocalizedRecoverySuggestion=None of the valid provisioning profiles allowed the specified entitlements: application-identifier, beta-reports-active, keychain-access-groups., NSLocalizedDescription=No matching provisioning profiles found, DVTCodesignResolverError_ResolutionInputsKey=<DVTCodesignResolutionInputs: 0x7fdbcc6d65f0; portalTeamID='47UH3S589T', usingTeamBasedSigning='NO', bundleIdentifier='com.wearehathway.welkio.beta', targetName='(null)', provisioningProfileType='1', requiresProvisioningProfile='YES', provisioningProfilePlatform='ios', certificateKind='1.2.840.113635.100.6.1.4', requiredEntitlements='{\n    \"application-identifier\" = \"47UH3S589T.com.wearehathway.welkio.beta\";\n    \"beta-reports-active\" = 1;\n    \"keychain-access-groups\" =     (\n        \"47UH3S589T.com.wearehathway.welkio.beta\"\n    );\n}', requiredCodesignableDevices='(null)', requiredFeatures='(null)'>\n}";
};
}
2015-09-19 20:27:36.346 xcodebuild[49814:7224280] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fdbcc64ecb0>: Error Domain=IDEDistributionErrorDomain Code=3 "(null)" UserInfo={IDEDistributionErrorSigningIdentityToItemToUnderlyingErrorKey={
"<DVTSigningCertificate: 0x7fdbc9f8dfb0; name='iPhone Distribution: Hathway Technology Group LLC', hash='3283D4CF4D60D2515D80D0AFAEA55325E9DE8B81', certificateKind='1.2.840.113635.100.6.1.4'>" =     {
"<IDEDistributionItem: 0x7fdbcea25e60 'com.wearehathway.welkio.beta' '<DVTFilePath:0x7fdbcc7607f0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app'>'>" = "Error Domain=DVTCodesignResolverErrorDomain Code=7 \"No matching provisioning profiles found\" UserInfo={NSLocalizedRecoverySuggestion=None of the valid provisioning profiles allowed the specified entitlements: application-identifier, beta-reports-active, keychain-access-groups., NSLocalizedDescription=No matching provisioning profiles found, DVTCodesignResolverError_ResolutionInputsKey=<DVTCodesignResolutionInputs: 0x7fdbcc6d65f0; portalTeamID='47UH3S589T', usingTeamBasedSigning='NO', bundleIdentifier='com.wearehathway.welkio.beta', targetName='(null)', provisioningProfileType='1', requiresProvisioningProfile='YES', provisioningProfilePlatform='ios', certificateKind='1.2.840.113635.100.6.1.4', requiredEntitlements='{\n    \"application-identifier\" = \"47UH3S589T.com.wearehathway.welkio.beta\";\n    \"beta-reports-active\" = 1;\n    \"keychain-access-groups\" =     (\n        \"47UH3S589T.com.wearehathway.welkio.beta\"\n    );\n}', requiredCodesignableDevices='(null)', requiredFeatures='(null)'>\n}";
};
}}
error: exportArchive: The operation couldn’t be completed. (IDEDistributionErrorDomain error 3.)

Error Domain=IDEDistributionErrorDomain Code=3 "(null)" UserInfo={IDEDistributionErrorSigningIdentityToItemToUnderlyingErrorKey={
"<DVTSigningCertificate: 0x7fdbc9f8dfb0; name='iPhone Distribution: Hathway Technology Group LLC', hash='3283D4CF4D60D2515D80D0AFAEA55325E9DE8B81', certificateKind='1.2.840.113635.100.6.1.4'>" =     {
"<IDEDistributionItem: 0x7fdbcea25e60 'com.wearehathway.welkio.beta' '<DVTFilePath:0x7fdbcc7607f0:'/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 20.25.39.xcarchive/Products/Applications/Welkio.app'>'>" = "Error Domain=DVTCodesignResolverErrorDomain Code=7 \"No matching provisioning profiles found\" UserInfo={NSLocalizedRecoverySuggestion=None of the valid provisioning profiles allowed the specified entitlements: application-identifier, beta-reports-active, keychain-access-groups., NSLocalizedDescription=No matching provisioning profiles found, DVTCodesignResolverError_ResolutionInputsKey=<DVTCodesignResolutionInputs: 0x7fdbcc6d65f0; portalTeamID='47UH3S589T', usingTeamBasedSigning='NO', bundleIdentifier='com.wearehathway.welkio.beta', targetName='(null)', provisioningProfileType='1', requiresProvisioningProfile='YES', provisioningProfilePlatform='ios', certificateKind='1.2.840.113635.100.6.1.4', requiredEntitlements='{\n    \"application-identifier\" = \"47UH3S589T.com.wearehathway.welkio.beta\";\n    \"beta-reports-active\" = 1;\n    \"keychain-access-groups\" =     (\n        \"47UH3S589T.com.wearehathway.welkio.beta\"\n    );\n}', requiredCodesignableDevices='(null)', requiredFeatures='(null)'>\n}";
};
}}

** EXPORT FAILED **
[20:27:36]: Exit status: 70
[20:27:36]: Variable Dump:
[20:27:36]: {:ENVIRONMENT=>"beta", :PLATFORM_NAME=>nil, :LANE_NAME=>"build", :GIT_REPO_WAS_CLEAN_ON_START=>true, :BUILD_NUMBER=>"193", :VERSION_NUMBER=>"0.5.2", :SIGH_PROFILE_PATH=>"/Users/dj/Documents/Hathway/Welkio/iOS/build/InHouse_com.wearehathway.welkio.beta.mobileprovision", :SIGH_UDID=>"7da34753-452c-46a7-a85a-a10730655d49"}
[20:27:36]: Error packaging up the application

I am also using sigh with fastlane and have code signing set up as recommend (using $(PROFILE_UDID)).

Here is there relevant part of my my Fastlane file:

  sigh({
    app_identifier: ENV["BUNDLE_IDENTIFIER"],
    username: ENV["APPLE_ID"],
    team_id: ENV["APPLE_TEAM_ID"],
    output_path: ENV["BUILD_PATH"]
  })

  ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID]

  gym(
    clean: true,
    output_directory: ENV["BUILD_PATH"],
    output_name: "Welkio-#{lane_context[SharedValues::BUILD_NUMBER]}",
    scheme: "Welkio"
  )

Note everything works when building for App Store distribution. The only thing that changes for Enterprise distribution is the bundle identifier (ENV["BUNDLE_IDENTIFIER"]) and the team ID (ENV["APPLE_TEAM_ID"]).

As far as I can tell, all my certificates / provisioning profiles seem to be in order. The sigh step runs successfully with the appropriate bundle identifier and I do have a valid Enterprise distribution certificate installed on my machine with its private key.

[20:51:37]: ------------------
[20:51:37]: --- Step: sigh ---
[20:51:37]: ------------------
[20:51:37]: Starting login with user 'dj@tarazona.me'
[20:51:38]: Successfully logged in
[20:51:38]: Fetching profiles...
[20:51:42]: Found 1 matching profile(s)
[20:51:42]: Downloading provisioning profile...
[20:51:42]: Successfully downloaded provisioning profile...
[20:51:42]: Installing provisioning profile...
./build/InHouse_com.wearehathway.welkio.beta.mobileprovision

Even though gym does not complete, the archive is available in the Xcode Organizer and I can successfully export the IPA from the Organizer (Export > Save for Enterprise Deployment > Export one app for all compatible devices).

Using gym 0.6.2. Thanks @KrauseFx for all the hard work! :) I hope this isn't a dumb oversight on my part.

@KrauseFx
Copy link
Contributor

Thank you so much for your very detailed report. Could you try updating to the latest gym and use the new option:

sigh --export_method enterprise

or in your Fastfile

sigh(export_method: 'enterprise')

More information: https://github.com/fastlane/gym/releases/tag/0.7.0

@djtarazona
Copy link
Author

Wow that was fast @KrauseFx! 🚀

Unfortunately I'm still getting an error, but it is different now:

[21:30:23]: ------------------
[21:30:23]: --- Step: sigh ---
[21:30:23]: ------------------
[21:30:23]: Starting login with user 'dj@tarazona.me'
[21:30:25]: Successfully logged in
[21:30:25]: Fetching profiles...
[21:30:29]: Found 1 matching profile(s)
[21:30:29]: Downloading provisioning profile...
[21:30:29]: Successfully downloaded provisioning profile...
[21:30:29]: Installing provisioning profile...
./build/InHouse_com.wearehathway.welkio.beta.mobileprovision
[21:30:29]: -----------------
[21:30:29]: --- Step: gym ---
[21:30:29]: -----------------
[21:30:29]: Installing provisioning profile...
[21:30:29]: xcrun xcodebuild -list -workspace './Welkio.xcworkspace'
[21:30:30]: xcrun xcodebuild -showBuildSettings -workspace './Welkio.xcworkspace' -scheme 'Welkio'

+------------+--------------------------+
|        Building Application 🚀         |
+------------+--------------------------+
| Workspace  | ./Welkio.xcworkspace     |
| Scheme     | Welkio                   |
| Platform   | iOS                      |
| Xcode Path | /Applications/Xcode.app/ |
+------------+--------------------------+

[21:30:31]: set -o pipefail && xcodebuild -workspace './Welkio.xcworkspace' -scheme 'Welkio' -destination 'generic/platform=iOS' -archivePath '/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 21.30.31.xcarchive' clean archive | xcpretty

-----
▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/Cartography [Release]                                                                                                       ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/MMMarkdown [Release]                                                                                                        ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/LogEntries [Release]                                                                                                        ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/CocoaLumberjack [Release]                                                                                                   ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/KeychainAccess [Release]                                                                                                    ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/OMGHTTPURLRQ [Release]                                                                                                      ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/SDWebImage [Release]                                                                                                        ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/SocketRocket [Release]                                                                                                      ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/PromiseKit [Release]                                                                                                        ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/Spring [Release]                                                                                                            ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/Toucan [Release]                                                                                                            ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/UIResponder+KeyboardCache [Release]                                                                                         ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/libPhoneNumber-iOS [Release]                                                                                                ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/libPusher [Release]                                                                                                         ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Pods/Pods [Release]                                                                                                              ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Building Welkio/Welkio [Release]                                                                                                                                                                                                                                                      ▸ Signing /Users/dj/Library/Developer/Xcode/DerivedData/Welkio-cjyktnzzsalczghkprmaxrmyavjt/Build/Intermediates/ArchiveIntermediates/Welkio/▸ Touching Welkio.app.dSYM                                                                                                                  -----                                                    

[21:32:22]: Successfully stored the archive. You can find it in the Xcode Organizer.
[21:32:22]: You're using Xcode 7, the `provisioning_profile_path` value will be ignored
[21:32:22]: Please follow the Code Signing Guide: https://github.com/KrauseFx/fastlane/blob/master/docs/CodeSigning.md
[21:32:22]: /usr/bin/xcrun xcodebuild -exportArchive -exportOptionsPlist '/tmp/gym_config_1442723542.plist' -archivePath '/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 21.30.31.xcarchive' -exportPath '/tmp/1442723542' 
2015-09-19 21:32:22.414 xcodebuild[57578:7303917] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/yc/hkdr9bt97nvfshd494n3lm940000gn/T/Welkio_2015-09-19_21-32-22.413.xcdistributionlogs'.
2015-09-19 21:32:23.165 xcodebuild[57578:7303917] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7f9ca021ff40>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **
[21:32:23]: Exit status: 70
[21:32:23]: Variable Dump:
[21:32:23]: {:ENVIRONMENT=>"beta", :PLATFORM_NAME=>nil, :LANE_NAME=>"build", :GIT_REPO_WAS_CLEAN_ON_START=>true, :BUILD_NUMBER=>"193", :VERSION_NUMBER=>"0.5.2", :SIGH_PROFILE_PATH=>"/Users/dj/Documents/Hathway/Welkio/iOS/build/InHouse_com.wearehathway.welkio.beta.mobileprovision", :SIGH_UDID=>"7da34753-452c-46a7-a85a-a10730655d49"}
[21:32:23]: Error packaging up the application

Also, it may be worth mentioning that the archive is NOT is not added to Organizer anymore (previously, even though gym failed, I was still able to find the archive in Organizer). Edit: Nevermind, the archive is still added to Organizer.

I'm still building with Fastlane, therefore the revalant part of my Fastfile now looks like this:

  sigh({
    app_identifier: ENV["BUNDLE_IDENTIFIER"],
    username: ENV["APPLE_ID"],
    team_id: ENV["APPLE_TEAM_ID"],
    output_path: ENV["BUILD_PATH"]
  })

  ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID]

  gym(
    clean: true,
    export_method: 'enterprise',
    output_directory: ENV["BUILD_PATH"],
    output_name: "Welkio-#{lane_context[SharedValues::BUILD_NUMBER]}",
    scheme: "Welkio"
  )

@KrauseFx
Copy link
Contributor

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}

Does building + exporting work with Xcode?

@djtarazona
Copy link
Author

Yes, archiving and exporting works in Xcode. Note that when I export from the Organizer, I get this Device Support screen.

screen shot 2015-09-19 at 9 48 35 pm

I'm not sure if that has anything it do with the No applicable devices found. error?

@djtarazona
Copy link
Author

@KrauseFx This may help: https://forums.developer.apple.com/thread/13446

compileBitcode NO was the magic exportOptionsPlist value that let me proceed. All the options are now documented; type xcodebuild -help to see them.

@KrauseFx
Copy link
Contributor

You mean compileBitcode must be set to NO in the case of enterprise profiles?

@KrauseFx
Copy link
Contributor

That's what I'm doing right now

        hash = { method: Gym.config[:export_method] }

        if Gym.config[:export_method] == 'app-store'
          hash[:uploadSymbols] = (Gym.config[:include_symbols] ? true : false)
          hash[:uploadBitcode] = (Gym.config[:include_bitcode] ? true : false)
        end

@djtarazona
Copy link
Author

It looks like that may be the case. At least according to the xcodebuild --help documentation:

Available keys for -exportOptionsPlist:

compileBitcode : Bool

  For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.

But I tried manually editing the plist file adding a compileBitcode key:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>method</key>
        <string>enterprise</string>
        <key>compileBitcode</key>
        <false/>
</dict>
</plist>

And it still didn't work when I re-ran the command:

$ /usr/bin/xcrun xcodebuild -exportArchive -exportOptionsPlist '/tmp/gym_config_1442725475.plist' -archivePath '/Users/dj/Library/Developer/Xcode/Archives/2015-09-19/Welkio-193 2015-09-19 22.02.29.xcarchive' -exportPath '/tmp/1442725475' 
2015-09-19 22:08:11.607 xcodebuild[66470:7354156] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/yc/hkdr9bt97nvfshd494n3lm940000gn/T/Welkio_2015-09-19_22-08-11.606.xcdistributionlogs'.
2015-09-19 22:08:12.319 xcodebuild[66470:7354156] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fbf24adf680>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **

That's what I'm doing right now

I see nothing related to compileBitcode in that code...

@djtarazona
Copy link
Author

It's interesting that the IDEDistributionThinningStep is failing. I even tried added <none> for the thinning key. No dice. :(

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>enterprise</string>
    <key>compileBitcode</key>
    <false/>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>

Oh Apple... is there an easy way to determine what Xcode's Organizer is doing under-the-hood?

@djtarazona
Copy link
Author

Okay, after digging and digging into the log files in the *.xcdistributionlogs folder, I found that the export was failing after invoking /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool '/var/folders/yc/hkdr9bt97nvfshd494n3lm940000gn/T/IDEDistributionThinningStep.N3Y' '--json' '/var/folders/yc/hkdr9bt97nvfshd494n3lm940000gn/T/ipatool-json-filepath-Ja1' '--info' '--toolchain' '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr' '--platforms' '/Applications/Xcode.app/Contents/Developer/Platforms'.

So, I tried running this myself in terminal and I got an error message indicating the cfpropertylist and then sqlite3 gems were not installed. ipatool is a Ruby script that appears to output a large JSON file with details on the supported devices for the iOS application. Since it was failing when I ran the command in terminal, I suspected it was failing when gym invoked xcodebuild. If it failed, xcodebuild would be unable to determine the supported devices, thus the No applicable devices found. error.

I'm using rvm, so I switched back to the system Ruby rvm system. Sure enough, now ipatool worked from my terminal. Then I had to install fastlane and gym again (as these gems were not available under the system Ruby environment). Once those were installed, it worked!

So, it appears that using rvm was the issue. ipatool needs to be run under Mac OS X's included Ruby environment. Perhaps it will also work if I install the cfpropertylist and sqlite3 gems in my rvm environment. I'm having trouble getting sqlite3 working with rvm so I can't test that right now.

It's a shame I have to switch to the system Ruby (rvm system) to use gym. @KrauseFx is there any way to have gym force xcodebuild to run under the system Ruby environment so that when it invokes ipatool it has all the necessary gems available?

Edit: It looks like you can do rvm system do COMMAND. But then you'd have to determine if rvm is installed on the users system. I guess I'll just stick with remembering to rvm system before running gym.

TL;DR: ipatool which is invoked by xcodebuild was failing when I ran gym under my rvm ruby-2.1.3 environment. Switching back to the system Ruby rvm system and then running gym / fastlane fixed the issue. It works! :)

@KrauseFx
Copy link
Contributor

Very interesting, thanks for taking a closer look. I'm using both rvm and rbenv on 2 different Macs and it has been working on both machines.

I'm glad you found a way to get it working! 🚀

@djtarazona
Copy link
Author

@KrauseFx Do you have the cfpropertylist and sqlite3 gems installed in your rvm environment? If you do, I suspect it would work fine.

I guess you can consider this issue closed now. Unless you have a way of forcing xcodebuild / ipatool to run under the system Ruby always?

@marcelofabri
Copy link

@djtarazona I think that forcing them to use system Ruby is not the right call. Probably it's better to add cfpropertylist and sqlite3 to gym.gemspec.

@djtarazona
Copy link
Author

@marcelofabri Ya I thought about that. My concern is that Apple's ipatool may expect the specific system Ruby version or something. I had enough difficultly getting the sqlite3 gem working properly with Ruby 2.1.3 under rvm.

@masa-beheim
Copy link
Contributor

I was running into the same issue ("No applicable devices found."). rvm system did the trick for me too. Thank you @djtarazona !

@jshier
Copy link

jshier commented Sep 21, 2015

I'm running into a similar issue, and running rvm system didn't fix it (or perhaps just moved the failure to another point). I'm getting a lot of Can't find any applicable signing identities for items errors. I can export from Xcode just fine. I've even set use_legacy_build_api: true and nothing has changed. Any ideas?

Is there any documentation for all of the gym options (as used through fastlane), what they mean, and which ones you should use on Xcode 7?

Edit: For now I've switched back to ipa (wow it's slow) to build our Crashlytics archives.

@KrauseFx
Copy link
Contributor

I just pushed a new release https://github.com/fastlane/gym/releases/tag/0.7.1, basically you can fallback to the old way of code signing using the use_legacy_build_api option.

@KrauseFx
Copy link
Contributor

@jshier please try gym 0.7.2, there was a bug in 0.7.1

@jshier
Copy link

jshier commented Sep 21, 2015

@KrauseFx Thanks, that works. I can switch back to gym and cut my ipa build times in half.

@KrauseFx
Copy link
Contributor

🚀 💪

@NikhilRyan
Copy link

Hi @KrauseFx thanks for this awesome tool.
I have an issue with gym, i'm currently running gym 0.7.3 and getting this error with gym --export_method enterprise and also with gym.

screen shot 2015-09-23 at 6 47 52 pm

@truth3
Copy link

truth3 commented Sep 23, 2015

@NikhilRyan Did you add the use_legacy_build_api flag when running gym?

@NikhilRyan
Copy link

@truth3 thanks for the reply. I just tried use_legacy_build_api and it's working great. but i'm not getting what it's doing under the hood. will you please tell me what it is doing ?
thanks

@truth3
Copy link

truth3 commented Sep 23, 2015

@NikhilRyan I don't have the specifics, but If you see Felix's reply a couple days ago.. it will revert back to the old way of code signing (I believe more specifically on the export action). Outside of that, all I know is that it works 👍

@KrauseFx
Copy link
Contributor

Are you trying to export for AdHoc? if so, make sure to pass the export_method ad-hoc to gym.

Basically the new way to code sign and export your app with Xcode 7 works for most setups but might cause some issues as it does additional verifications.

@KrauseFx
Copy link
Contributor

Use whatever works for you 👍

@hiltonc
Copy link

hiltonc commented Sep 23, 2015

--export_method enterprise saved the day here. Thank you!

@KrauseFx
Copy link
Contributor

I just pushed https://github.com/KrauseFx/fastlane/releases/tag/1.29.1 which now will automatically detect the export type if you use sigh and gym within fastlane 🚀

@JaviSoto
Copy link

Fastfile or Gymfile? before, Fastlane was able to infer that that profile was Enterprise and do the right thing. Where would I put that?
Thanks @kdawgwilk!

@kdawgwilk
Copy link

@JaviSoto It looks like @KrauseFx fixed the problem and will be released shortly and then you should be back in business without having to add the export_method 😊

@JaviSoto
Copy link

@kdawgwilk woot! Do you mind pointing to the PR with the change? I'd like to check it out, and see if it's been fixed for me.

@lacostej
Copy link
Contributor

I struggled with the "No applicable devices found" issue for a while.

(iOS 9.2, Xcode 7.2, OS 10.11.2)

@skywinder
Copy link

@KrauseFx still has this issue..

    sigh
    gym(
        clean: true,
        workspace: workspace,
        scheme: scheme,
        configuration: configuration,
        include_bitcode: false,
        export_method: "development",
        ) 

->>>
error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo=0x7fad490684f0 {NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **
[14:16:09]: Exit status: 70

@skywinder
Copy link

use_legacy_build_api true string in Gymfile works.
Why don't make this option as default for now?

@lacostej
Copy link
Contributor

lacostej commented Jan 9, 2016

From 1.3.0, gym will output more information about the underlying failure.

To everyone having this issue, including @skywinder, @JaviSoto @kcharwood, I suggest to try with the latest gym without use_legacy_build_api: true. If things still fail:

  1. take note of the new output
  2. merge PR Issue #168 wrap xcodebuild calls within ruby system environment #176 locally and try again. Make sure the xcrun xcodebuild export command now uses the xcbuild-safe.sh wrapper.

Report outputs for both attempts if it still fails. Let us know if step 2 fixes it for you. Thanks!

@jshier
Copy link

jshier commented Jan 11, 2016

Tried again with 1.3.0, failed with this error, plus a lot of output:

[16:07:18]: Exit status: 70
[16:07:18]: 2016-01-11 21:07:17 +0000 [MT] Running step: IDEDistributionSigningAssetsStep with <IDEDistributionContext: 0x7fa43b653910; archive(resolved)='<IDEArchive: 0x7fa43b5ccc10>', distributionTask(resolved)='2', distributionMethod(resolved)='<IDEDistributionMethodEnterprise: 0x7fa43b0d1440>', teamID(resolved)='(null)'>
    Chain (2, self inclusive):
    <IDEDistributionContext: 0x7fa43b653910; archive = '(null)', distributionMethod='<IDEDistributionMethodEnterprise: 0x7fa43b0d1440>', teamID='(null)'>
    <IDEDistributionContext: 0x7fa43b5ce910; archive = '<IDEArchive: 0x7fa43b5ccc10>', distributionMethod='(null)', teamID='(null)'>
</IDEDistributionContext: 0x7fa43b653910>

Any idea how I would run that PR locally using RVM and Bundler?

@kinwahlai
Copy link

@jshier PR#176 had been merged to master, so you can install gem from master branch.

i added this into my Gemfile and run bundle install
gem 'gym', :git => 'https://github.com/fastlane/gym.git', :branch => "master"

@lacostej it works for me.

@KrauseFx
Copy link
Contributor

@kinwahlai I already pushed a new gym release too 👍

@lacostej
Copy link
Contributor

@kinwahlai cool
@jshier can't wait to see if gym 1.4.0 fixed your issue

@jshier
Copy link

jshier commented Jan 13, 2016

This seems to have fixed the issue for me. Will this work on a Jenkins install as well? That's really my only concern moving forward.

@KrauseFx
Copy link
Contributor

I actually run into the same issue right now. I tried the same export step with Xcode and the requests time out. Maybe this actually sends some kinds of requests to Apple to validate something?

@JaviSoto
Copy link

I just tried again without legacy API, I get this:

error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **

@lacostej
Copy link
Contributor

@JaviSoto do you get more output after EXPORT FAILED ? Are you sure you are using gym 1.4.0 or later ?

@JaviSoto
Copy link

I'm using 1.5.2. This is all I see:

error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **
[16:59:20]: Exit status: 70
[16:59:20]:
[16:59:20]: There was an error exporting your application
[16:59:20]: Unfortunately the new Xcode export API is unstable and causes problems on some project
[16:59:20]: You can temporary use the :use_legacy_build_api option to get the build to work again

[!] Error packaging up the application

@lacostej
Copy link
Contributor

@JaviSoto it cannot be 1.5.2. The latest release of gym is 1.4.0 and should display a different output. I suggest you try updating gym (gem update gym or whatever you need for your environment).

@JaviSoto
Copy link

Oh, I'm sorry, that was my fastlane version, my gym version is indeed 1.4.0. And I don't see anything outputted besides that :(

@jessearmand
Copy link

I'm using gym version 1.6.0

Before the output above, it fails to require sqlite3, even though I've already did install on the system ruby.

2016-02-17 10:14:19 +0000 [MT] Running /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool '/var/folders/ps/lzhg100124903rf6tw026grh0000gn/T/IDEDistributionThinningStep.cbT' '--json' '/var/folders/ps/lzhg100124903rf6tw026grh0000gn/T/ipatool-json-filepath-xME' '--info' '--toolchain' '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr' '--platforms' '/Applications/Xcode.app/Contents/Developer/Platforms'
2016-02-17 10:14:19 +0000  Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
2016-02-17 10:14:19 +0000  Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
2016-02-17 10:14:19 +0000  /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sqlite3 (LoadError)
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:24:in `<main>'
2016-02-17 10:14:19 +0000 [MT] /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool exited with 1
2016-02-17 10:14:19 +0000 [MT] ipatool JSON: (null)

@jessearmand
Copy link

Figured it out, I'm using chruby system, and making sure the gym, CFPropertyList and sqlite3 are installed under system ruby.

@bencollier
Copy link

Hit by this as the Root Apple WWDR cert has expired; try these:

Open up Keychain Access.
Show expired certificates by going to View > Show Expired Certificates.
Navigate to the System keychain and delete the expired WWDR Certificate.
Download the new WWDR Certificate here and import it into your keychain.

https://www.reddit.com/r/iOSProgramming/comments/45siza/this_certificate_has_an_invalid_issuer/

@jessearmand
Copy link

@bencollier That's already solved in the latest release.

Regarding this issue I don't think use_legacy_build_api should be an advice when this build error happens. Ultimately app thinning is needed, which I'm only aware is possible without legacy build api?

In most cases the error are more related to the ruby & ruby gems setup of the machine, than anything else.

@fastlanebot
Copy link

This issue was migrated to fastlane/fastlane#3193. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests