I'm trying to debug a React Native app which is already published in to the AppStore and while the app has a bunch of console.info / console.warn calls — seems that no log messages reach the device log (which I access through Xcode > Device & Simulators > some device > Open Console).
Also, I've just created a test app and added a bunch of console calls there, and while I see them all in Chrome Inspector it seems that they never reach device logs.
So the question is — am I doing something wrong or the console calls are actually not logged into the device log? If so, is there any other solution to do it? Something as simple as NSLog preferred.
Thanks a lot
Related
I created an iMessage extension. When I install it on one phone (via Xcode), everything works fine. Same with simulator.
When I attempt to connect a friend's phone and launch the app, it shows a blank screen. I can't find a crash nor other information in the Xcode console nor the macOS console.
I'm guessing the device is either too old (iPhone X), or the app is crashing on this phone for some reason.
Any idea what's wrong?
You must trust the developer of the iMessage extension on every device you want it to run:
Settings > General > Device Management > (Developer App)
Trust
Then try running the extension again.
You can get more details at Apple's article: https://support.apple.com/en-us/HT204460
While testing a release build of our React Native app on iOS, we discovered a defect with an input component that only occurred after the app had been in the background for a longer time (e.g. 1h). Presumably, this occurs after the app has been suspended by the OS.
I'm now trying to debug this issue, but when I run the app on a test device in debug mode and connected to the React Native Debugger, turn the screen off for some time and then bring the app back to the foreground, it will show a red screen with Runtime is not ready for debugging. error. This does not happen when I immediately bring the app back to the foreground after turning the screen off, so I suppose it's also related the app being suspended.
We're using React 16.3.0 and React Native 0.54.0 (preparing an update in a separate branch).
Can anyone help me understand what's going on here, and provide a suggestion on how to debug this issue?
Could you use something like Sentry for bug reporting? Not only does it log JavaScript errors, but native crashes too. This is great for seeing continuous errors encountered by your users, whilst in production.
You could also run a production build and debug it via USB.
Navigate to Product > Scheme > Edit Scheme. Ensure you've selected Production in the Build Configuration. Also select Debug Executable.
Once the application launches, go to View > Debug Area > Activate Console. You should now see any native logs from your app.
Can't really help with the problem that you're facing but you should take a look at Reactotron for debugging in react-native.
I obviously know where they go when I'm testing the app in Xcode.
But if I were to release an app to the App Store that contained print statements, would they be logged in the user's device somewhere or would they just be ignored?
They get logged to the user's device in a way that they're accessible from Xcode. Apple explains the behavior here.
There is an internal "console" for each app. They are not necessarily logged anywhere except in this internal console. When you test your app in Xcode, it connects to this internal console and copies any print statements from the the device to Xcode for developers to see.
Newbie here, so apologies if this is stupid question:
Are there any applications or solutions out there that would allow you access to debugging events on an app installed on your iphone? To be clear, this isn't an app I've developed, it's just on my iphone and is used as part of another solution which we are developing. Curious if there's a way to just watch the events on an app to help with debugging process.
Thanks.
If you make an app, and build it with a development release, and development signing, you can select to build+run it on a device. Then, you can use the Xcode debugger to see your logs / errors etc.
Steps:
Plug in iPhone
Start Xcode
Hit Build + run
Watch debugger
Logs are either made by the OS for certain things (NSinconsistency, bad constraints, race conditions in view presentation) or by you with NSLog.
Or did you mean when the app is not tethered to your computer? There are other tools for that - including just plugging the phone back in and downloading the logs off the device.
This question might be a bit strange and i apologize for that... i have rather a strange problem with my iPad app. My app is running absolutely fine when i connect the device to my system and run the app. But,it is getting crashed repeatedly once i try to use the app after disconnecting it from my system. This is very strange to me. I am unable to even debug this because of this strange issue. i need at least GDB log to debug my code.So, is there any way in which i can print my GDB log on my device(iPad)... At least is there any other way in which i can solve this strange issue...
Is it crashing while you are debugging and then disconnect the device. If you disconnect your device while debugging, the app will stop on your device and you need to reopen it to continue using it on the device.
If you want the Logs stored on your device, connect your device to your Mac and in Xcode go to Window -> Organiser. Select the Devices Tab and on the left should be your Device and an option to view the Device Logs which should get you the same Crash Logs you get in the Debugger Output window. Xcode will Symbolise them if it can so you should be able to debug the issue. It will also show Crash Logs for Applications you do not develop but those will not be Symbolised so won't make much sense.
Alternatively, if you choose the Console option you'll be able to see the Console output which will show all your NSLog outputs. It will also have some Device Specific output which you can ignore.
Use NSLog(), you can read the resulting console entries in the Xcode organiser after connecting the device via USB: