简体   繁体   English

使用Xcode和Cocoa Pod进行代码签名

[英]Code Signing with Xcode & Cocoa pods

I have a added pods to my project. 我在项目中添加了广告连播。 Currently i have added 2 pods. 目前,我已经添加了2个豆荚。 So there are three targets in Pods.xcodeproj. 因此Pods.xcodeproj中有三个目标。

And my podfile looks like this 我的podfile看起来像这样

platform :ios, "8.0"
use_frameworks!

target 'ARSConsumerMaster-Sample1' do

pod 'ObjectMapper', '~> 0.19'
pod 'JSONModel', '~> 1.2.0'

end

target 'ARSConsumerMasterTests' do
end

target 'ARSConsumer-Sample2' do
end

I have found this snippet. 我发现了这个片段。 But not sure where to write these 但不确定在哪里写这些

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

Even if i use this and say not to codesign in build settings, i get an error that codesigning is mandated in the latest versions. 即使我使用此功能并说不对构建设置进行代码签名,我也会收到错误消息,要求在最新版本中进行代码签名。

Should i create separate provisioning profile/ Bundle identifier for my pods project? 我应该为我的Pod项目创建单独的配置文件/捆绑标识符吗? How should i code sign? 我应该如何编码签名?

This solved the issue 这解决了问题

Create ExportPlist.plist with TeamId and export archive with the same 使用TeamId创建ExportPlist.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>xxxxxxxxx</string>
        <key>method</key>
        <string>app-store</string>
        <key>uploadSymbols</key>
        <true/>
    </dict>
</plist>

xcodebuild -exportArchive \
           -archivePath ${WORKING_DIRECTORY}/Archive/${APP_NAME}.xcarchive 
           -exportOptionsPlist exportPlist.plist

I have added this snippet to the PodFile. 我已将此片段添加到PodFile中。 I am able to build successfully with the App Store provisioning profile and cert. 我能够使用App Store的配置文件和证书成功构建。 However deployment fails with error 但是,部署失败并显示错误

"Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value 'XXXXXXXXXX.com.company.appcenter' for key 'application-identifier' in 'Payload/app/Frameworks/Alamofire.framework/Alamofire' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier.” “无效的代码签名权利。您的应用程序捆绑包的签名包含iOS上不支持的代码签名权利。具体地说,在'Payload / app / Frameworks / Alamofire中,密钥'application-identifier'的值为'XXXXXXXXXX.com.company.appcenter'。不支持framework / Alamofire”。该值应该是一个字符串,以您的TEAMID开头,后跟点“。”,然后是包标识符。”

XXXXXXXXXX being the prefix for registered appid XXXXXXXXXX是注册的appid的前缀

If you are using distribution certificate to create your build, set the code signing of pods also to iOS distribution -> Automatic. 如果您使用分发证书来创建构建,则将Pod的代码签名也设置为iOS分发->自动。

If you are using development certificate to create your build, set the code signing of pods also to iOS development -> Automatic. 如果您使用开发证书来创建构建,请将pod的代码签名也设置为iOS开发->自动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM