简体   繁体   English

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

[英]Realm app compiles on device but not on simulator on Xcode 12

I have a Realm app that was running fine in Xcode 11 in both, the device and the Simulator.我有一个Realm应用程序,它在设备和模拟器的Xcode 11中都运行良好。 I recently updated to Xcode 12 and now the app doesn't compile in any of the Simulators but works fine on physical devices.我最近更新到Xcode 12 ,现在该应用程序无法在任何模拟器中编译,但在物理设备上运行良好。 After researching I noticed that Realm suggests adding some build settings in your Podfile to exclude the arm64 , so I went and added it but I'm still getting errors.经过研究,我注意到Realm建议在您的Podfile添加一些构建设置以排除arm64 ,所以我去添加了它,但我仍然遇到错误。

Here is what I have done in more detail.这是我所做的更详细的工作。

Original Podfile looked like this :原始 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

Here is what I did step by step.这是我一步一步做的。

  1. I compiled my app for the first time in Xcode 12 and I got the following error.我第一次在 Xcode 12 中编译了我的应用程序,但出现以下错误。

在此处输入图片说明

  1. I modified my PodFile to what Realm recommends adding the following code at the end of the Podfile.我将我的 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. In the terminal I entered pod install .在终端中,我输入了pod install

  3. Recompiled my project and it got rid of the first error but it now shows the following error.重新编译我的项目,它摆脱了第一个错误,但现在显示以下错误。

在此处输入图片说明

Any idea what could be wrong now?知道现在可能出了什么问题吗?

在我的情况下,将Realm升级到最新版本10.1.0并将cocoapods更新到1.10.0解决了该问题,我现在可以在模拟器上进行编译。

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

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