ios - use_frameworks 签名错误!和独特的配置文件

标签 ios objective-c swift xcode cocoapods

我在此处粘贴我在初始讨论中的最后一篇文章:

https://github.com/CocoaPods/CocoaPods/issues/4331

这个问题已经存在快一年了,仍然没有找到合适的解决方案。

构建时:

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”.

注意!使用(在 mypod.podspec 文件中)将 PureLayout 作为依赖项添加到我的 pod 中: s.dependency 'PureLayout', '3.0.2'

这是我的 Pod 的整个 podspec 文件:

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'
end

注意事项:

  1. 放弃使用 CocoaPods 不是一种选择。

  2. 使用@DimaVartanian 修复会导致类似@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. 我的项目还使用 PushNotifications,因此不能使用任何通配符配置文件。

  4. 这是我的健身路线

    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
    

    当应用@DimaVartanian 修复程序时,此行没有任何错误,但如上所述,它会在上传过程中导致ERROR ITMS-90035ERROR ITMS-90171

    这是我上传构建的试验行:

    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. 我还可以确认在使用 xcode 构建/存档/上传时存在同样的问题。

  6. 将此 --export_options "ExportOptions.plist" 添加到 gym 命令行,没有任何区别。尝试通过 xcargs --xcargs "PROVISIONING_PROFILE=$APP_PROVISION_UUID exportOptionsPlist=$EXPORT_OPTIONS_PLIST" 也失败了。

    文件内容如下:

    <?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>teamID</key>
       <string>TEAMID123</string>
       <key>uploadSymbols</key>
       <string>NO</string>
       <key>compileBitcode</key>
       <false/>
       <key>uploadBitcode</key>
       <false/>
       <key>method</key>
       <string>app-store</string>
    </dict>
    </plist>
    

我希望 CocoaPods 团队能尽快解决这个问题。

简而言之 - 失败的是以下序列的结尾:

  1. 在 Objectvie-C 中创建基础项目或采用任何旧的维护的 Objective-C 项目
  2. 在 Swift 中创建并实现一个框架(Cocoa Touch Framework)项目
  3. 为该框架创建 podspec 并将其上传到存储库
  4. 使用 CocoaPods 将该框架包含到基础项目中
  5. 在模拟器和有线设备上构建和运行应用程序没问题(一切都按预期工作)
  6. 构建和/或上传到 iTunesConnect 不成功,失败了!

稍后我会尝试添加一个示例项目来演示这个问题。

最佳答案

好的,所以这次我用自己的方式解决了这个问题。 通常,解决方案比想象的要简单。

错误错误 ERROR ITMS-90171 的原因这次是 podspec 文件中的一个指令。

这个:s.resource = 'MyPod/*'

不知道我怎么漏掉了那个,但“MyPod/*”字面意思是,包括 MyPod 目录中的所有内容,除了图形 Assets 外,还包含 *.swift 文件。

所以通过将该行更改为:s.resource = 'MyPod/Graphics.xcassets' 解决了这个问题。不再有错误 ITMS-90171。


但是, 在这里,我们仍然必须使用一种解决方法(由@DimaVartanian 提出)来修复 cocoapods 提供的框架的代码签名要求。

修复本身是将此代码添加到基础项目的“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"
    end
  end
end

这将(在“pod install”之后)遍历项目中的所有 pod 目标,并通过更改某些设置来删除代码签名要求,如您在代码中所见。

有一些谣言称,升级到 XCode 8 后将不再需要此解决方法。我尚未找到任何官方证实,但我希望这是真的。

关于ios - use_frameworks 签名错误!和独特的配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39160654/

相关文章:

objective-c - 在 Objective-C 中使用 block

ios - 未调用 Google 登录代理

swift - tvos uicollectionview 相对焦点

ios - 无法在 facebook-ios-sdk 中获取 user_birthday 和 user_hometown 的权限

ios - Segue/unwind 反复导致内存在加载视频时不断增加

html - 为什么 iOS Safari(和 iOS Chrome)显示背景图片的方式与其他浏览器不同?

ios - 单击 "load earlier items"按钮时如何将 UITableView 滚动位置设置为上一个位置

iphone - 如何删除一个部分中的一行并隐藏该部分?

ios - 如何清除 iOS 9 和 iOS 10 上的缓存

ios - TableView 不显示来自 JSON 的数据