building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Viewed 11624

Getting this error.

Realm/core/librealmcore-ios.a(array_binary.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Swift iOS 14 xcode 12.0.1

What I have tried :

  • Updating to the latest realm
  • Excluding the arm64 architecture

Nothing seems to work Seems realm are having issues too : https://realm.io/docs/swift/latest/#cocoapods

"Arm64 simulator architecture may not be supported for several combinations of Realm 5.x and Xcode 12. Please attempt the following workarounds if you experience architecture-related build errors with the latest version of Realm."

3 Answers

Use

pod 'RealmSwift', '~> 10.5.0'

They already added support for xcframework.

It's not really a proper fix, but what worked for my project is:

Now when you build your app for your device or you're archiving make sure to set this back to No, or alternatively, use a different config for this (e.g: I have Debug set to Yes, Release to No).

What I did was

setting the BuildActiveArchitectureOnly to Yes in the build settings.

And

installer.pods_project.targets.each do |target|
      
      target.build_configurations.each do |config|
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end

And

Updated my Realm to the latest version.

Related