Xcode 12 Realm 应用程序在设备上编译但在模拟器上不编译

Realm app compiles on device but not on simulator on Xcode 12

我有一个 Realm 应用程序 运行 在设备和模拟器中 Xcode 11 都很好。我最近更新到 Xcode 12,现在该应用程序无法在任何模拟器中编译,但在物理设备上运行良好。研究后我注意到 Realm 建议在你的 Podfile 中添加一些构建设置以排除 arm64,所以我去添加它但我仍然遇到错误。

这是我所做的更详细的内容。

原始 Podfile 看起来像这样:

def shared_pods
    pod 'RealmSwift', '~> 3.18'
end

target 'MyApp' do
    use_frameworks!
    platform :ios, '10.0'

    shared_pods
    
    target 'MyAppTests' do
        inherit! :search_paths
    end
    
    target 'MyAppUITests' do
        inherit! :search_paths
    end
end

target 'MyApp Watch App' do
    use_frameworks!
    platform :watchos, '3.1'
    
    # Pods for MyApp Watch App
    shared_pods
end

target 'MyApp Watch App Extension' do
    use_frameworks!
    platform :watchos, '3.1'
    shared_pods
end

这是我一步一步做的。

  1. 我在 Xcode 12 中第一次编译我的应用程序,但出现以下错误。

  1. 我将 PodFile 修改为 Realm 建议在 Podfile 末尾添加以下代码。

     post_install do |installer|
         installer.pods_project.targets.each do |target|
             target.build_configurations.each do |config|
                 config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
                 config.build_settings['EXCLUDED_ARCHS[sdk=watchsimulator*]'] = 'arm64'
                 config.build_settings['EXCLUDED_ARCHS[sdk=appletvsimulator*]'] = 'arm64'
             end
         end
     end
    
  2. 在终端我输入了pod install.

  3. 重新编译我的项目,它摆脱了第一个错误,但现在显示以下错误。

知道现在出了什么问题吗?

在我的例子中,将 Realm 升级到最新版本,10.1.0 并将 cocoapods 更新到 1.10.0 解决了问题,我现在可以在模拟器上编译了。