Xcode 在将 iOS 应用程序上传到 App Store 时尝试匹配框架包 ID
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36511359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode trying to match frameworks bundle ID when uploading iOS app to App Store
提问by Alex
After 4 months developing my first iOS app, it's time to submit it to the App Store
. I created the app in iTunes Connect
, filled in all the details, set up the correct Bundle ID
in both Connect
and Xcode
. However, I've struggled the last 3 days trying to solve this weird problem. It seems like xcode is trying to upload Cocoapods
frameworks, not my main app.
在开发了我的第一个 iOS 应用程序 4 个月后,是时候将它提交给App Store
. 我在 中创建了应用程序iTunes Connect
,填写了所有详细信息,Bundle ID
在Connect
和中都设置了正确的Xcode
。但是,过去 3 天我一直在努力解决这个奇怪的问题。似乎 xcode 正在尝试上传Cocoapods
框架,而不是我的主应用程序。
After archiving, I went to Window > Organizer > Validate...
. I see the following screen:
存档后,我去了Window > Organizer > Validate...
。我看到以下屏幕:
The error:
错误:
(For googlers: No suitable application records were found. Verify your bundle identifier 'org.cocoapods.Alamofire
' is correct).
(对于 googlers:未找到合适的应用程序记录。验证您的包标识符“ org.cocoapods.Alamofire
”是否正确)。
The error message indicates that it's trying to match a Bundle ID
according to a framework's name, not my own bundle (e.g com.organization.AppName
). I can't find answers anywhere. I tried doing the following in my Podfile
(which has use_frameworks!), as well as my different conf combinations but had no success.
错误消息表明它试图Bundle ID
根据框架的名称匹配 a ,而不是我自己的包(例如com.organization.AppName
)。我在任何地方都找不到答案。我尝试在我的Podfile
(它有 use_frameworks!)以及我不同的 conf 组合中执行以下操作,但没有成功。
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
Questions:
问题:
- Are the steps I'm making correct?
- Why is
Xcode
trying to match aframework's bundle id
instead of just my main application? - How can I get past this problem to finally submit my app?
- 我做的步骤正确吗?
- 为什么
Xcode
要匹配 aframework's bundle id
而不仅仅是我的主应用程序? - 我怎样才能克服这个问题以最终提交我的应用程序?
EDIT 1:I was able to get past this problem, but that caused another problem later, so I still don't have a solution. Basically, Alamofire Pod (from Cocoapods) has a bundle id com.xxx.Alamofire
. I changed it to com.xxx.myAppName
. With that, I was able to send it to the App Store, however I can't install the app in my iPhone from TestFlight due to the following error:
编辑 1:我能够解决这个问题,但后来又引起了另一个问题,所以我仍然没有解决方案。基本上,Alamofire Pod(来自 Cocoapods)有一个 bundle id com.xxx.Alamofire
。我把它改成com.xxx.myAppName
. 这样,我就可以将它发送到 App Store,但是由于以下错误,我无法从 TestFlight 在我的 iPhone 中安装该应用程序:
4/22/16, 12:50:29 AM itunesstored[124]: [ApplicationWorkspace]: Failed to install application: com.xxx.myAppName; /var/mobile/Media/Downloads/5927832272594571027/-6969961974973998640; Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=DuplicateIdentifier, ErrorDescription=The parent bundle has the same identifier (com.xxx.myAppName) as sub-bundle at /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.IVHCuO/extracted/Payload/MyApp.app/Frameworks/Alamofire.framework}
采纳答案by Alex
After quite some time struggling with this, I was able to make it work. Basically, only Alamofire was presenting this issue. Here's what I did:
在为此苦苦挣扎了一段时间之后,我终于能够让它发挥作用。基本上,只有 Alamofire 提出了这个问题。这是我所做的:
- In the Navigator, click in Pods.
- Under Targetsyou will see all the frameworks your app is using.
- Click on Alamofire(or the framework that is causing the issue).
- Edit the Bundle Identifier. If your app Bundle Id is
com.company.appName
, writecom.company.appName.Alamofire
in it.
- 在导航器中,单击Pods。
- 在目标下,您将看到您的应用程序正在使用的所有框架。
- 单击Alamofire(或导致问题的框架)。
- 编辑捆绑标识符。如果您的应用程序包 ID 是
com.company.appName
,请com.company.appName.Alamofire
在其中写入。
I tried com.company.appName
for the framework, com.company.Alamofire
, nothing worked.
我尝试com.company.appName
了框架com.company.Alamofire
,没有任何效果。
回答by neilge
I was receiving this exact error when trying to submit the app to iTunes Connect: "No suitable application records were found. Verify your bundle identifier 'org.cocoapods.Alamofire' is correct".
尝试将应用程序提交到 iTunes Connect 时,我收到了这个确切的错误:“没有找到合适的应用程序记录。请验证您的包标识符 'org.cocoapods.Alamofire' 是否正确”。
I finally fixed it by changing the Bundle OS Type codeto APPL.
我最终通过将Bundle OS Type 代码更改为APPL来修复它。
回答by Geovanny Buitrago
It works perfectly for me. I just located Info.plist right-click open as "source code" and I changed <key>CFBundlePackageType</key>
to string APPL
它非常适合我。我刚刚找到 Info.plist 右键单击打开为“源代码”,然后我更改<key>CFBundlePackageType</key>
为字符串 APPL
<key>CFBundlePackageType</key>
<string>APPL</string>
回答by Simo
Just experienced this issue with the following error displayed when attempting to upload to the App Store.
刚刚在尝试上传到 App Store 时遇到此问题并显示以下错误。
iTunes Store operation failed.
No suitable application records were found. Verify your bundle identifier 'org.cocoapods.Alamofire' is correct
iTunes Store 操作失败。
没有找到合适的申请记录。验证您的包标识符 'org. cocoapods.Alamofire' 是正确的
We encountered this when attempting to upload (whilst using Cocoapods) and failing to find a fix, took the drastic action of removing Cocoapods from our project entirely and instead manually added each pod as a framework.
我们在尝试上传(同时使用 Cocoapods)时遇到了这个问题,但未能找到修复方法,我们采取了彻底的行动,将 Cocoapods 从我们的项目中完全删除,而是手动将每个 Pod 添加为一个框架。
And...... the upload to the App Store still failed with basically the same error!
并且......上传到App Store仍然失败,错误基本相同!
iTunes Store operation failed.
No suitable application records were found. Verify your bundle identifier 'org.alamofire.Alamofire' is correct
iTunes Store 操作失败。
没有找到合适的申请记录。验证您的包标识符 'org. alamofire.Alamofire' 是正确的
So this looks like it is possibly an error relating to framework usage within Xcode itself.
因此,这看起来可能是与 Xcode 本身中的框架使用相关的错误。
Finding that this wasn't being necessarily caused by Cocoapods, we decided to keep using Cocoapods and came up with the following steps to fix this.
发现这不一定是 Cocoapods 引起的,我们决定继续使用 Cocoapods 并提出以下步骤来解决这个问题。
The fix:
修复:
Our project contains 2 targets (ignoring unit test targets etc). 1 for the application (let's call it MyApp) and another that contains the network layer and other non app specific functionality (let's call this MyAppKit).
我们的项目包含 2 个目标(忽略单元测试目标等)。1 用于应用程序(我们称之为MyApp),另一个包含网络层和其他非应用程序特定功能(我们称之为MyAppKit)。
- Add
CFBundlePackageType
(also known asBundle OS Type code
) to MyApp'sInfo.plist
and set it toAPPL
. - Make sure that both the project MyApp and the target MyApp have the build setting
Always Embed Swift Standard Libraires
toYes
. - Make sure that the target MyAppKit has the build setting
Always Embed Swift Standard Libraires
toNo
.
- 添加
CFBundlePackageType
(也称为Bundle OS Type code
)到 MyAppInfo.plist
并将其设置为APPL
. - 确保项目 MyApp 和目标 MyApp 的构建设置都
Always Embed Swift Standard Libraires
为Yes
。 - 确保目标 MyAppKit 的构建设置
Always Embed Swift Standard Libraires
为No
.
Still looking into exactly what's going on here, but thought this may be useful to anyone who's currently experiencing this.
仍在调查这里到底发生了什么,但认为这可能对目前正在经历这种情况的任何人有用。
回答by softninja
Recently, I had also same issue while I publish the app using cocoapods. It was Objective-C project and has been integrating pods as dynamic frameworks.
最近,我在使用 cocoapods 发布应用程序时也遇到了同样的问题。它是 Objective-C 项目,并且一直在将 pod 集成为动态框架。
This is already reported bug.
这是已经报告的错误。
So I recommends following 2 alternatives to work around this issue:
因此,我建议使用以下 2 种替代方法来解决此问题:
Use static library instead of dynamic framework. For that, you can comment # use_frameworks! line in your pod file.
If you need to use framework, you could try below steps:
Add your framework as embedded binary in Xcode target.
In build phases of your target, add a Run Script:
使用静态库而不是动态框架。为此,您可以评论 # use_frameworks!pod 文件中的一行。
如果您需要使用框架,您可以尝试以下步骤:
将您的框架添加为 Xcode 目标中的嵌入式二进制文件。
在目标的构建阶段,添加一个运行脚本:
Example Script:
示例脚本:
# Stripping framework only for archive
if [ "$ACTION" = "install" ]; then
FRAMEWORK_NAME="Framework name"
SCRIPT_FILE_NAME="strip-framework.sh"
# Set working directory to product's embedded frameworks
cd "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/${FRAMEWORK_NAME}.framework"
# Get architectures for current file
ARCHS="$(lipo -info "${FRAMEWORK_NAME}" | rev | cut -d ':' -f1 | rev)"
for ARCH in $ARCHS; do
if ! [[ "${VALID_ARCHS}" == *"$ARCH"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$ARCH" -output "$FRAMEWORK_NAME" "$FRAMEWORK_NAME" || exit 1
fi
done
echo "Framework was successfully stripped with unsupported architectures"
fi
# Removing script from framework folder
if [ -f ${SCRIPT_FILE_NAME} ]; then
rm -rf "${SCRIPT_FILE_NAME}"
fi
Note: please replace your framework name in this script!, you ensure to put this script file named as "strip-framework.sh" into the top level of framework directory.
注意:请在此脚本中替换您的框架名称!,请确保将此名为“strip-framework.sh”的脚本文件放入框架目录的顶层。
3rd party frameworks never signed by providers and its duty of consumers. So when you archive, it signs your frameworks together with your app bundle. But after doing that, Application loader consider your bundle identifier as one of framework. Its weird thing yet.
供应商从未签署过第三方框架及其消费者的义务。因此,当您归档时,它会将您的框架与您的应用程序包一起签名。但是这样做之后,应用程序加载器会将您的包标识符视为框架之一。它的奇怪的事情。
After 2 days working around, I could publish my app finally.
经过 2 天的工作,我终于可以发布我的应用程序了。
Even if you could submit by doing this tricky, it will never been installed on the devices.
即使您可以通过执行此棘手的操作来提交,它也永远不会安装在设备上。
Finally, I got a perfect solution and found out the reason. This is happening because your 3rd party frameworks have some issues in it. For example, in my case Quickblox framework has never supported bitcode yet. So I had to disable bitcode in build settings for the main target and frameworks totally. This will fix your issue for sure.
最后,我得到了一个完美的解决方案,并找出了原因。发生这种情况是因为您的第 3 方框架存在一些问题。例如,就我而言,Quickblox 框架从未支持过位码。所以我不得不在主要目标和框架的构建设置中完全禁用位码。这肯定会解决您的问题。
Please review this screenshot:
I hope this will help you guys.
Cheers!
回答by Eugene Pinchuk
If your apptitle has usual slash "/", then xcode failed to sign it, and thinks that I'm uploading first framework org.cocoapods.***
如果您的应用标题通常带有斜杠“/”,则 xcode 未能对其进行签名,并认为我正在上传第一个框架 org.cocoapods.***
What I did - changed slash to similar symbol ∕
我所做的 - 将斜杠更改为类似的符号 ∕
(first slash, next one - other unicode symbol : ∕/)
(第一个斜杠,下一个 - 其他 unicode 符号:∕/)
回答by Szymon Klimaszewski
回答by Hemant Sharma
First please check your bundle identifier. Next please make sure your app is created in-app store connect, which might be one of the reasons not able to upload the app to the store.
首先请检查您的捆绑包标识符。接下来请确保您的应用程序是在应用程序商店连接中创建的,这可能是无法将应用程序上传到商店的原因之一。