In certain scenarios where runtime errors occur, the debug info provided by the NativeScript CLI or by the application's XCode project is not sufficient. This article will guide you through the steps needed to debug the iOS Runtime library as a part of your NativeScript application. It implies you have the ios-runtime repository already cloned and set up. For more info on how to setup the ios-runtime project on your machine refer to its README.
1. Create a new NativeScript application using one of the following commands depending on your platform preference:
You can skip this step if you want to use some of your existing apps
NativeScript with Angular:
tns create debug-ios-runtime --ng
NativeScript with TypeScript:
tns create debug-ios-runtime --tsc
tns create debug-ios-runtime
tns prepare ios
WARNING: Make sure your environment fulfills all the requirements mentioned in ios-runtime's README.
IMPORTANT: If you drag it from Xcode where the Runtime's xcodeproj is currently open you will get an error, thus drag it from Finder after closing NativeScript.xcodeproj
Select your app target and go to General tab. Then under Embedded binaries select the
+ button and add
Open the Build Phases tab, expand the NativeScript PostBuild section and comment the
script invocation by changing
5. If you run the application project you should hit the breakpoint and see the printed text in the console: