tristanhimmelman / ObjectMapper

Simple JSON Object mapping written in Swift
MIT License
9.13k stars 1.03k forks source link

XCODE 12.0 Could not find module 'ObjectMapper' for target 'arm64-apple-ios-simulator'; #1121

Open mxnmike opened 3 years ago

mxnmike commented 3 years ago

Im using a M1 Mac, and I keep getting this error, are you planning in adding support soon for M1? Could not find module 'ObjectMapper' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_6

ManojKarkie commented 2 years ago

Hi @mxnmike , I am facing the same issue, any solution that worked for you ?

j796160836 commented 2 years ago

I'm encountered same issue here. Using Apple silicon (M1) too.

Note that is compile error only happen choosing iOS simulator. Choosing real device or Mac simulated iPad will no issues.

Here is more info about the differance between Intel Macs and Apple silicon (M1) Macs

Apple silicon (M1) Macs

Pod install using x86_64 mode

$ arch -x86_64 pod install

also, ffi is installed beforehand.

$ sudo arch -x86_64 gem install ffi

Intel Macs

j796160836 commented 2 years ago

OK, I found the solutions.
In short, not the ObjectMapper code problems.

You NEED TO set your Pods project's Build settings.

Build Active Architecture only set to NO

Like this.

Screen Shot 2021-12-12 at 5 31 53 PM

OR using ruby scripts for set every dependency modules Build Active Architecture only to NO.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |configuration|
      target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
    end
  end
end

Reference:
https://gist.github.com/funroll/7faf18b4972d72cd284e


It will solve the problems. 🙂