NativeScript: Build error : `building for iOS Simulator, but linking in dylib built for iOS`
Environment
- @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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 16 (1 by maintainers)
This seems to work for us for now:
We added this to the end of our App_Resources/iOS/build.xcconfig
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: https://github.com/Carthage/Carthage/issues/3019#issuecomment-664099506
@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 armv7to fix my first issueFacing this issue on M1 - Should I really exclude
arm64and expect it to work on M1. Please help. Many thanks@timoschlueter what we did was creating a .xconfig for the simulator and one for real device. That added some complexity so I will try your solution. thanks