Table of contents

How to Solve “Building for iOS Simulator, but linking in dylib built for iOS”

« Back to FAQ index

Dynamsoft framework can be used to build an app for arm64 iOS. If you build the app for arm64 simulator and you are migrating your app from older versions to Xcode 12 or higher, the following error message may pop up:

ld: “Building for iOS Simulator, but linking in dylib built for iOS, file ‘/ios/Pods/DynamsoftBarcodeReader/DynamsoftBarcodeReader.xcframework/DynamsoftBarcodeReader’ for architecture arm64”


To fix the error:

  1. Set Build Settings > Build Options > VALIDATE_WORKSPACE to “YES” and then rebuild your project
  2. Set Build Settings > Architectures > Build Active Architecture Only to “YES” and run on an iPhone device
  3. Set Build Settings > Architectures -> $(ARCHS_STANDARD)


If the error message still exists, please make one of the following changes:

Switch from framework to xcframeworks

Or

Excluded Architectures -> Debug -> Any iPhone simulator -> arm64

Or

Podfile:
post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Or

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "uname -m"
  end
end

Or

podspec:
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This page is compatible for: