devicekit / DeviceKit

DeviceKit is a value-type replacement of UIDevice.
MIT License
4.42k stars 431 forks source link

DeviceKit.swiftmodule is not built for arm64 #419

Open zakray opened 1 week ago

zakray commented 1 week ago

After installing DeviceKit, I'm unable to run my app via the simulator. I get "Build failed because DeviceKit.swiftmodule is not built for arm64, please try a run destination with a different architecture". After I got that error, a new simulator option with Rosetta appeared, but trying to build on that gave me a number of errors about "undefined symbol".

It does work fine on a real device.

Apologies if this is something obvious I'm missing, I don't have a lot of experience with swift packages. This is running latest macOS with Xcode 16 beta on an M2 Mac.

wmurmann commented 4 days ago

I've ran into this a few time while working on a silicon mac. If you're using pods one way to fix this is to add a post install script to your pod file that updates the architectures of each pod to exclude arm64 in debug mode. Not sure how to do it with swift package manager but if you move this dependency to a pod it should work fine.

  1. Close xcode
  2. Delete derived data
  3. run pod deintegrate
  4. Add this post install script to the end of your pod file
    post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if config.name == 'Debug'
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
      end
    end
    end
  5. pod install
zakray commented 3 days ago

Thanks for the suggestion, unfortunately I don't use CocoaPods