eye bleed eye bleed - 1 year ago 287
Objective-C Question

Signing errors with use_frameworks! and unique provisioning profiles

I am pasting my last post from Initial discussion here:


This issue has been around for almost a year, and still no proper solutions found.

When building:

Code Sign error: Provisioning profile does not match bundle identifier: The provisioning profile specified in your build settings (“MyDistributionProfileName”) has an AppID of “com.myorg.myapp” which does not match your bundle identifier “org.cocoapods.PureLayout”.

Note! PureLayout is added to my pod as a dependency using(in mypod.podspec file):
s.dependency 'PureLayout', '3.0.2'

This is the whole podspec file of my Pod:

Pod::Spec.new do |s|
s.name = 'MyPod'
s.version = '1.2.34'
s.license = { :type => "MIT", :file => "LICENSE" }
s.homepage = 'https-:-//bitbucket.org/XXXX123/my-pod'
s.authors = { "AuthorName" => "author@myorg.com" }
s.summary = 'This isa a cocoa pod that contains the MY framework.'
s.source = { :git => "https-:-//bitbucket.org/XXXX123/my-pod", :tag => "#{s.version}" }
s.ios.deployment_target = '8.0'
s.source_files = 'MyPod/**/*.{swift,h}'
s.resource = 'MyPod/*'
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO', 'ONLY_ACTIVE_ARCH' => 'NO'}
s.dependency 'PureLayout', '3.0.2'


  1. Dropping use of CocoaPods is not an option.

  2. Using the @DimaVartanian fix leads to similar errors like encountered by @mgrebenets

    ERROR ITMS-90035 Invalid Signature. Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https-:-//developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html"

    ERROR ITMS-90171 Invalid Bundle Structure - The binary file 'XApp.app/Frameworks/X.framework/XView.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https-:-//developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.

  3. My project uses also PushNotifications so can't use any wildcard provision profiles.

  4. Here's my gym line for building a build

    gym --clean --scheme ${XCODE_PROJECT_TARGET_NAME} --configuration Release --include_bitcode false --archive_path ${BUILDS_DIR}${PACKAGE_NAME}.xcarchive --output_directory $BUILDS_DIR --output_name "${PACKAGE_NAME}.ipa" --xcargs PROVISIONING_PROFILE=$APP_PROVISION_UUID

    This line works without any errors when @DimaVartanian fix is applied, but as above, it leads to ERROR ITMS-90035 and ERROR ITMS-90171 during upload process.

    Here's my pilot line for uploading a build:

    pilot upload --skip_submission --username ${APPLE_ID_USERNAME} --team_id ${APPLE_ITUNES_CONNECT_TEAM_ID} --verbose --ipa ${BUILDS_DIR}${PACKAGE_NAME}.ipa --skip_waiting_for_build_processing true

  5. I can also confirm that same issue exists when build/archive/upload using xcode.

  6. Adding this
    --export_options "ExportOptions.plist"
    to gym commandline, did not make any difference. Also failed by trying via xcargs

    Contents of the file is as follows:

    <?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">

I am hoping the CocoaPods team will fix this quickly.

To say in short - what fails is the end of following sequence:

  1. Create base project in Objectvie-C or take any old maintained Objective-C project

  2. Create and implement a framework (Cocoa Touch Framework) project in Swift

  3. Create podspec for that framework and upload it to repository

  4. Include that framework into base project using CocoaPods

  5. Build and run app on simulator and on wired device is OK (everything works as expected)

  6. Build and/or Upload to iTunesConnect is NOT OK, it FAILS!

I will try to add a sample project later on, to demo the issue.

Answer Source

Ok, so I solved this time this problem my own way. As usually, the solution is easier than ever thought.

The cause of bugger error ERROR ITMS-90171 was this time a directive in podspec file.

This one: s.resource = 'MyPod/*'

No idea how I missed that one, but 'MyPod/*' literally says, include everything in MyPod's directory which besides the graphics assets contained the *.swift files as well.

So a little fix by changing that line to: s.resource = 'MyPod/Graphics.xcassets' fixed the problem. No ERROR ITMS-90171 any more.

However, Here we still have to live with a workaround (proposed by @DimaVartanian) that fixes the code-signing requirement for frameworks provided by cocoapods.

The fix itself is to add this code to base project's 'Podfile':

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
      config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
      config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"

That will go(after 'pod install') through all pod targets in project and remove the code signing requirement by changing certain settings as you can see in code.

There are some rumours around, that this workaround will not be required anymore after upgrading to XCode 8. I have not found any official confirmation on this but I hope it is true.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download