关于swift:Xcode在将iOS应用上传到App Store时尝试匹配框架包ID

Xcode trying to match frameworks bundle ID when uploading iOS app to App Store

在开发了我的第一个iOS应用4个月之后,该将其提交到App Store了。我在iTunes Connect中创建了应用程序,并填充了所有详细信息,并在ConnectXcode中都设置了正确的Bundle ID。但是,最近3天我一直在努力解决这个怪异的问题。似乎xcode正在尝试上传Cocoapods框架,而不是我的主应用程序。

存档后,我去了Window > Organizer > Validate...。我看到以下屏幕:

enterorg.cocoapods.Alamofire"正确)。

错误消息表明它正在尝试根据框架的名称而不是我自己的捆绑包(例如com.organization.AppName)匹配Bundle ID。我在任何地方都找不到答案。我尝试在我的Podfile(具有use_frameworks!)以及不同的conf组合中执行以下操作,但是没有成功。

1
2
3
4
5
6
7
8
9
10
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

enter

All

问题:

  • 我做的步骤正确吗?
  • 为什么Xcode试图匹配framework's bundle id而不是仅匹配我的主应用程序?
  • 我如何克服这个问题才能最终提交我的应用程序?

编辑1:我能够解决此问题,但是稍后又导致了另一个问题,因此我仍然没有解决方案。基本上,Alamofire Pod(来自Cocoapods)具有束ID com.xxx.Alamofire。我将其更改为com.xxx.myAppName。这样,我就可以将其发送到App Store,但是由于以下错误,我无法从TestFlight将其安装到iPhone中:

1
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}


对我来说效果很好。我只是找到Info.plist,右键单击" "源代码"打开,然后将<key>CFBundlePackageType</key>更改为字符串APPL

1
2
<key>CFBundlePackageType</key>
<string>APPL</string>


尝试将应用程序提交到iTunes Connect时,我收到此确切错误:"找不到合适的应用程序记录。请验证您的捆绑包标识符\\'org.cocoapods.Alamofire \\'是正确的"。

我终于通过将Bundle OS Type代码更改为APPL来修复了它。


经过一段时间的努力之后,我得以实现它。基本上,只有Alamofire提出此问题。这是我的工作:

  • 在导航器中,单击"窗格"。
  • 在目标下,您将看到您的应用程序正在使用的所有框架。
  • 单击Alamofire(或引起问题的框架)。
  • 编辑捆绑包标识符。如果您的应用程序捆绑包ID为com.company.appName,请在其中写入com.company.appName.Alamofire
  • 我为框架com.company.Alamofire尝试了com.company.appName,没有任何效果。


    刚刚遇到此问题,尝试上传到App Store时显示以下错误。

    iTunes Store operation failed.

    No suitable application records were found. Verify your bundle identifier 'org.cocoapods.Alamofire' is correct

    我们在尝试上载(虽然使用Cocoapods)并且找不到修复程序时遇到了这个问题,采取了从整个项目中删除Cocoapods的剧烈动作,而是手动将每个吊舱添加为框架。

    然后......上载到App Store仍然失败,并显示基本相同的错误! ??

    iTunes Store operation failed.

    No suitable application records were found. Verify your bundle identifier 'org.alamofire.Alamofire' is correct

    所以看起来这可能是与Xcode本身中的框架使用有关的错误。

    发现这不一定是由Cocoapods引起的,我们决定继续使用Cocoapods,并提出了以下步骤来解决此问题。

    解决方法:

    我们的项目包含2个目标(忽略单元测试目标等)。 1用于应用程序(我们将其称为MyApp),另一个用于网络层和其他非应用程序特定功能(我们将其称为MyAppKit)。

  • CFBundlePackageType(也称为Bundle OS Type code)添加到MyApp \\的Info.plist并将其设置为APPL
  • 确保项目MyApp和目标MyApp的构建设置都将Always Embed Swift Standard Libraires设置为Yes
  • 确保目标MyAppKit的构建设置为Always Embed Swift Standard LibrairesNo
  • 仍在仔细研究此处的情况,但认为这可能对当前正在经历此情况的任何人有用。


    最近,我在使用cocoapods发布应用程序时遇到了同样的问题。
    这是Objective-C项目,一直在将pod集成为动态框架。

    这是已报告的错误。

    因此,我建议采用以下2种替代方法来解决此问题:

    • 使用静态库代替动态框架。
      为此,您可以评论#use_frameworks!您的pod文件中的一行。

    • 如果需要使用框架,可以尝试以下步骤:

    • 将框架作为嵌入式二进制文件添加到Xcode目标中。

    • 在目标的构建阶段,添加一个运行脚本:

    示例脚本:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    # 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.

    第三方框架从未由提供者签署,并且没有承担消费者的责任。
    因此,当您存档时,它会与您的应用程序包一起签署框架。但是在执行此操作之后,应用程序加载程序会将您的捆绑包标识符视为框架之一。还很奇怪。

    经过2天的工作后,我终于可以发布我的应用了。

    即使您可以通过这种棘手的方式提交,也永远不会将其安装在设备上。

    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.

    请查看以下屏幕截图:
    Disable


    首先,请检查您的捆绑商品标识符。接下来,请确保您的应用是在应用内商店连接中创建的,这可能是无法将应用上传到商店的原因之一。


    就我而言,我必须从Pods子项目中删除Provisioning配置文件设置
    enter

    我所做的-将斜杠更改为类似的符号∕

    (第一个斜杠,下一个-其他Unicode符号:∕/)