How to Fix NativeScript Issue with iOS14 and XCode 12

With the release of iOS14 and XCode 12, NativeScript apps started crashing. Unfortunately, the timing conflicted with the release of NativeScript 7 which caused lots of confusion. I ran into this issue with a NativeScript app that I built.  Since I didn’t want to update the entire app to NativeScript 7 and wanted to get a quick fix out, I was able to make minor changes that fixed the app. To find this solution, I spent several hours trying different solutions and wanted to write this guide to help others that may be facing these issues.

The error I was seeing before these changes

[runtime executeModule:@"./"];
Thread 1: EXC_BAD_ACCESS (code=1, address=0x2818dd0)

Step 1

Add Podfile to app/App_Resources/iOS/ folder with this content:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
            config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
        end
    end
  end

Step 2

Add this content to app/App_Resources/iOS/build.xcconfig file

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

Step 3

Update to tns-ios 6.5.2

tns platform remove ios
tns platform add [email protected]

Step 4

tns build ios --release

You should now be able to build and test your app. Let me know if this solves your issues.

6 thoughts to “How to Fix NativeScript Issue with iOS14 and XCode 12”

  1. Thanks for this! Had random reports of my app crashing (it’s been released for a while) and couldn’t reproduce it. Updated libraries and submitted it to the App store, and the App store reported it failing. Your fix resolved it for me!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.