SolvedNativeScript Build error : building for iOS Simulator, but linking in dylib built for iOS


  • @nativescript/core: 6.5.12
  • iOS Runtime: tns-ios 6.5.2
  • xcode 12 beta 5
  • iOS 14

Describe the bug
I tried to build my app for simulator AND real device using tns debug ios with xcode beta 5 out of the box and I got this first error :
error: The linked framework 'Pods_<myapp>.framework' is missing one or more architectures required by this target: i386.

then to avoid having this error I added the following to app/App_Reources/iOS/build.xcconfig:
EXCLUDED_ARCHS = i386 armv7

and now I am getting this error:

ld: building for iOS Simulator, but linking in dylib built for iOS, file '/myapp/app/platforms/ios/internal//NativeScript.framework/NativeScript' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If i add arm64 to the list of excluded architectures, it builds for simulator but it wont build for real device.
and in the other way if I add x86_64 to the list of excluded archs, it will build for device but not for sim...

Can't find any config to be able to build for both simulator and real device. like it was with previous version of Xcode.

15 Answers

✔️Accepted Answer

This seems to work for us for now:

We added this to the end of our App_Resources/iOS/build.xcconfig

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8

This excludes the arm64 architecture for the simulator. Since we are developing on Intel only right now we are fine with this.
I did not come up with this myself. Found the solution over here: Carthage/Carthage#3019 (comment)

Other Answers:

@JimLynchCodes this is actually a problem we also ran into a few weeks ago.

Just add


to your App_Resources/iOS/build.xcconfig.

Also remove the platform folder and try running the app again. It should work now.

@timoschlueter it helped ! thank you !
though I had to add EXCLUDED_ARCHS = i386 armv7 to fix my first issue

More Issues: