|
| 1 | +--- |
| 2 | +layout: default-layout |
| 3 | +title: How to resolve the "Building for iOS Simulator, but linking in dylib built for iOS" error when building for the iOS simulator? |
| 4 | +keywords: Dynamsoft Barcode Reader, FAQ, Mobile, tech basic, ios, arm64, simulator, exclude architectures |
| 5 | +description: How to resolve the "Building for iOS Simulator, but linking in dylib built for iOS" error when building for the iOS simulator? |
| 6 | +needAutoGenerateSidebar: true |
| 7 | +--- |
| 8 | + |
| 9 | +# How to resolve the "Building for iOS Simulator, but linking in dylib built for iOS" error when building for the iOS simulator? |
| 10 | + |
| 11 | +[<< Back to FAQ index](index.md) |
| 12 | + |
| 13 | +DBR iOS can be used to build apps that belong to the arm64 architecture. If you try building an app for the arm64 simulator, and you migrated your app from an older version of Xcode to Xcode 12 or higher, then you might encounter the following error message: |
| 14 | + |
| 15 | +> ld: "Building for iOS Simulator, but linking in dylib built for iOS, file '/ios/Pods/DynamsoftBarcodeReader/DynamsoftBarcodeReader.framework/DynamsoftBarcodeReader' for architecture arm64" |
| 16 | +
|
| 17 | +<br /> |
| 18 | + |
| 19 | +In order to fix the error, please take the following steps under the *Build Settings* of the Xcode project: |
| 20 | + |
| 21 | +1. Under *User-Defined* -> find *VALIDATE_WORKSPACE* and set it to **YES**. Rebuild your project. |
| 22 | + |
| 23 | +2. Under *Architectures* -> find *Build Active Architecture Only* and set it to **YES**. |
| 24 | + |
| 25 | +3. Under *Architectures* -> make sure that *Architectures* is set to $(ARCHS_STANDARD). |
| 26 | + |
| 27 | +<br /> |
| 28 | + |
| 29 | +If the error message persists, please make one of the following changes: |
| 30 | + |
| 31 | +- Instead of using the .framework (which all the samples do by default), switch to using the corresponding .xcframework |
| 32 | + |
| 33 | +- Under the *Build Settings* -> find *Excluded Architectures* -> in the *Debug* field click the + icon -> select *Any iOS Simulator SDK* -> put "arm64" |
| 34 | + |
| 35 | +- You can also exclude architectures via the Podfile as such: |
| 36 | + |
| 37 | + ```ruby |
| 38 | + post_install do |installer| |
| 39 | + installer.pods_project.build_configurations.each do |config| |
| 40 | + config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" |
| 41 | + end |
| 42 | + end |
| 43 | + ``` |
| 44 | + OR |
| 45 | + ```ruby |
| 46 | + post_install do |installer| |
| 47 | + installer.pods_project.build_configurations.each do |config| |
| 48 | + config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "uname -m" |
| 49 | + end |
| 50 | + end |
| 51 | + ``` |
| 52 | + OR |
| 53 | + ```ruby |
| 54 | + podspec: |
| 55 | + s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } |
| 56 | + s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } |
| 57 | + ``` |
| 58 | + |
0 commit comments