How to debug `native Objective C code` in react-native? - ios

I'm using react native in my ios project. I can see all the logs from react native side in chrome console, and some auto generated logs in xcode.
I recently ran into a problem while using Firebase dynamic links in my app. There is a native module LinkManager which basically handles all the dynamic links to the app and sends the parsed url or the deeplink to my app.
But this is not working and I understood that the problem is inside the native module that handles it.
But when I try to give NSLogs, no output appears in the xcode console, nor in the simulator console(cmd + /). I'm wondering how can I debug the native code inside xcode.

You need to open your project in xCode and run it in any simulator. Then you can either add breakpoints on the desired line of code or use NSLogs to degug it or if it is crashing at a particular point, you can add a exception breakpoint in project.

If you want to see logs from native code in XCode debug together with your console.log from JS code, you can do it like this:
#import <React/RCTLog.h>
RCTLog(#"Hello world");

Related

Printing to console when implementing a single Flutter page in iOS app?

What I am trying to do:
I am working on an app that is currently written in native iOS and Android (Swift and Kotlin). We are wanting to gradually migrate these two apps into one code base via replacing individual native app pages with Flutter pages until we have a full Flutter app. When building the current, mostly Swift project on Xcode, the iOS app is using FlutterEngines to present individual Flutter pages and the Dart and Swift files are communicating via MethodChannels.
I am wanting to print to the console from within the Dart file of the individual Flutter page that is displayed in my iOS app.
What I've tried:
I've tried printing to the console by making use of the print() and log() methods in my Dart files. I've also tried running flutter attach from the terminal while running the iOS project in question and am successfully attaching to the app (I'm able to hot restart/reload), but my Dart files are still not printing to the console. What methods have you all used to print to the console from Dart files being accessed in an iOS project via FlutterEngine?
I have always used Print() to print to the console.
Maybe there is some issues with the data to be printed.
Just an opinion, I may be wrong.

React Native IOS - app gets stuck

I don't know whats going with my project but every time i try to run this .xworkspace file, it gets stuck at the default splash screen of react native. Please refer to the error below
You might have to check your xcode console and enable debug mode for more information.

How to identify iOS app extension crash in Xamarin.iOS?

In my Xamarin project, I have added a new app extension project to the solution.
It is running fine with it's auto generated default code. But when I change something in the MainInterface.storyboard and run again, the extension is not loading; it's crashing with a blink.
I am trying to find the reason for the crash. Since debugging extensions with Xamarin Studio is not possible at the moment, how can I detect the reason for the crash?
You have to use old-school way of debugging things for now, using NSLog or Console.WriteLine
These logs will show up in the Device Log pad in the Xamarin Studio or in System logs if you're testing extensions on simulator

Unable to debug a framework in Xcode 8

I have a framework project I built in debug mode. I added such resulting framework to another iOS project. My iOS project builds correctly and the framework is called, I get its methods results. However, some of the results are not the expected and I need to debug the framework's code from the iOS project.
I am also running the iOS project in debug mode and setting a breakpoint at the framework's method call I want to debug. But "step into" instruction in the debugger does not enter into the framework's code. In addition, if I "command-click" the name of the method to try to go to its code, I get an:
Couldn't Generate Swift Representation
My issue is similar to this one, but the answer there is not working for me. Is somebody experiencing the same? Could somebody provide another solution?

How to prevent framework to jump into the .m file when crashing in iOS

I am using XCode 6 to develop a SDK using static library. I grabbed the script from this link: http://www.raywenderlich.com/65964/create-a-framework-for-ios.
When I tried to crash it intentionally, the actual implementation is exposed. However, we wanted to hide it. Just like crashing a third party framework, for example Parse iOS SDK, it will jump to something like assembly code instead of the actual implementation file.
Here is image when crashing in Parse:
Any advances would be appreciate.
I think your setting is all correct, you can still see your implementation because you are using the same computer as you did development and being symbolicated automatically. It will be hidden when other users try to crash it.

Resources