Post

Could not find module 'xxx' for target 'x86_64-apple-ios-simulator'

` Could not find module ‘xxx’ for target ‘x86_64-apple-ios-simulator’; found: arm64-apple-ios-simulator, at: /Users/xxx/Library/Developer/Xcode/DerivedData/ExamplePod-gnqhkdbrzigmizayegbigopeyeut/Index.noindex/Build/Products/Debug-iphonesimulator/xxx/xxx.framework/Modules/xxx.swiftmodule`

https://github.com/facebook/react-native/issues/37627

修改podfile文件

1
2
3
installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end

完整demo如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
platform :ios, '9.0'

target 'Example' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Example
  pod 'LookinServer', :configurations => ['Debug']

  target 'ExampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ExampleUITests' do
    # Pods for testing
  end
  
  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"
      end
    end
  end

end
This post is licensed under CC BY 4.0 by the author.