ios - Xcode 12.4 为模拟器和设备构建,但使用 Pods-MYAPP-frameworks.sh : line 131: ARCHS[@]: unbound variable 归档失败

标签 ios swift xcode xcodebuild xcode12

我正在使用 Xcode 12.4(从 12.2 更新,希望我的问题得到解决)。如您所知,在 xcode 12.x 中,我们删除了 VALIDARCHS,将 arm64 添加到项目和 pod 文件中排除的 archs(仅适用于模拟器)。否则就会出现构建问题。我已经完成了我的开发,我已经准备好进行苹果的试飞,然后是最终的应用商店。如您所知,我们需要存档应用程序并从组织者上传。但是,我的应用程序归档失败。
我的问题是我可以成功地为所有模拟器和真实设备构建我的应用程序,但是,当我尝试存档应用程序时,它给了我一个错误:
Error Image Here
bash 脚本是 PODS 的脚本第 131 行的一部分:
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"

# Strip invalid architectures
strip_invalid_archs() {
  binary="$1"
  warn_missing_arch=${2:-true}
  # Get architectures for current target binary
  binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
  # Intersect them with the architectures we are building for
  intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
  # If there are no archs supported by this binary then warn the user
  if [[ -z "$intersected_archs" ]]; then
    if [[ "$warn_missing_arch" == "true" ]]; then
      echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
    fi
    STRIP_BINARY_RETVAL=1
    return
  fi
  stripped=""
  for arch in $binary_archs; do
    if ! [[ "${ARCHS}" == *"$arch"* ]]; then
      # Strip non-valid architectures in-place
      lipo -remove "$arch" -output "$binary" "$binary"
      stripped="$stripped $arch"
    fi
  done
  if [[ "$stripped" ]]; then
    echo "Stripped $binary of architectures:$stripped"
  fi
  STRIP_BINARY_RETVAL=0
}
到目前为止我做了什么?
  • 大概检查了 stackoverflow、苹果论坛、github 等上的每个解决方案。
  • 我在脚本中的 source 变量更改为 source:- 如上图所示
  • 我尝试过 xcodebuild 存档和其他在那里变坏的东西,所以我不想触摸终端进行存档。
  • 在寻找解决方案作为 podfile 的安装后解决方法时,我对其进行了更改,但没有任何效果。
  • 为项目和 pod 尝试了不同的配置。
  • 试图在 bash 脚本中的 strip_invalid_archs() 中进行解决,但遇到了其他错误。
  • 甚至尝试在 strip_invalid_archs() 中手动定义 ARCHS,因为我找不到任何东西

  • 我觉得架构有问题,因为归档需要所有可用的架构,所以它无法归档。我也认为这是一个 pod 问题,但我真的很迷茫。
    这是我的架构项目和 pod 配置:
    Project
    Pod
    # Uncomment the next line to define a global platform for your project
    platform :ios, '14.3'
    minimum_deployment_target = 14.3
    
    target 'MYAPP' do
      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
      use_frameworks!
    
      # Pods for MYAPP
    pod 'Firebase/Core'
    pod 'Firebase/Auth'
      pod 'Firebase/Database'
            pod 'Firebase/Firestore'
      pod 'Firebase/Storage'
    pod 'Firebase/Messaging'
    target 'MYAPPTests' do
        inherit! :search_paths
        # Pods for testing
      end
    
      target 'MYAPPUITests' do
        inherit! :search_paths
        # Pods for testing
      end
    
    post_install do |installer|
        installer.generated_projects.each do |project|
            project.targets.each do |target|
                target.build_configurations.each do |config|
                    # Ensure we set all Pods to match the minimum deployment target specified by the app
                    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_deployment_target
                end
            end
        end
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
            configuration.build_settings['ARCHS'] = 'arm64 armv7'
        end
    end
    
    
    
    end
    
    
    
    编辑
    podfile 中的 postinstall 部分是在归档失败后添加的。即使我的 podfile 中没有安装后部分,存档也不起作用。
    提前致谢。当我认为我完成它时无法存档应用程序真的很令人失望。我已经在这上面花了几天时间。如果你能帮忙就太好了。谢谢

    最佳答案

    我有同样的问题和这个 Github issue解决了我的问题。 TLDR:进入build设置并从有效和排除的体系结构中删除 arm64。

    关于ios - Xcode 12.4 为模拟器和设备构建,但使用 Pods-MYAPP-frameworks.sh : line 131: ARCHS[@]: unbound variable 归档失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66765084/

    相关文章:

    ios - 在 xcode 中使用像素而不是点?

    iphone - 为什么 Xcode 编译器没有警告我部署目标的无效方法?

    ios - 通过选择图像的一部分来创建具有边缘检测的掩模

    iphone - 如何在2部分中激活tableView didSelectRowAtIndexPath?

    ios - 是否可以测量 iOS 应用程序中的数据包丢失?

    ios - 我可以使用 Alamofire 检查 HTTP 服务器 URL 端点的可达性吗?

    ios - 将 12 位数字刻度转换为日期

    ios - Alamofire 4 从类型 '(_) throws -> ()' 的抛出函数到非抛出函数类型 '(DataResponse<Any>) -> Void' 的无效转换

    ios - Swift 中的零宽度空间?

    PhP 在使用 iOS 图像进行方向校正后上传 ImageJPEG