Debugging React Native apps in background - ios

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.

Related

OS killing the app when it going to background

I'm develop application on React native and have an unexpected behavior. When I minimize the app OS kill it, so when I come back to the app it start loads again. I just want to keep using app from the moment I minimezed it.
The same when I blocking device. Is it something wrong with my app or it's default behavior of OS?
It was caused by errors in "Release" build of the app. So, it's not a normal behavior!

Iphone App developed with KivyMD Crashing

I've created a game with KivyMD and currently I am testing it on iOS. I have tested the game on Android and it works flawlessly. The game builds successfully in XCode and once built, the game works fine on an iPhone. However, few days later, something seems to be going wrong and app starts to crash in iPhone. As soon as I launch the game, I see a black screen which appears to be a pre-splash. However, I haven't set a pre-splash for the game. If I rebuild the game in XCode again, it builds successfully with no errors and the app starts to work fine again for few more days and then it starts to crash. Can someone help me with the following?
Is there a way to look at the error message in some log file on iPhone when the app crashes?
Is there a debugging tool that I can use to troubleshoot when the app crashes?
Is there an iOS simulator app that I can use on my iMac to test the app?
XCode shows the build log as successful always. So, the app crashing appears to be a run-time error. Unfortunately, I am new to this and needs some help.
Thanks in advance.
UPDATE: You'll probably want to find a solution that is specific to Kivy. This answer may help. In fact, your question may be considered a duplicate:
https://stackoverflow.com/a/27175629/2476389
Generally, I recommend Firebase Crashlytics for crash logs. If a crash occurs in your app, the stack trace and other helpful info will be uploaded to your Firebase console the next time the app is started. You can see all your crashes in the console. You will need to follow the instructions to integrate crashlytics into your app and then release a new build, but it's well worth it. This will allow you to get crash logs from all devices (testers, users, etc).
https://firebase.google.com/docs/crashlytics
For crashes you can reproduce on your dev device, you can also retrieve the log directly:
https://developer.apple.com/news/?id=nra79npr

How to debug react-native iOS app crashing on startup after a week or so

I started messing around with react-native. I've built a small application and it seems to work fine (package.json). I can work on it in Debug or Release mode, using the simulator or my iPhone 6S device, and all is well.
This app is just for me so I don't pay for the Apple Developer thing, and I just run the app in Release mode on my device, and it...seems to be fine? I can quit xcode and go places and the app works fine.
After a week or so, it's hard to tell, the app stops loading. It'll display the splash screen for a split second and then it's gone back to the home screen.
I setup Rollbar, but it doesn't catch anything. I look in the Privacy -> Analytics area and don't see anything there either.
I'm not really looking for an answer to my exact problem since various SO questions and other places suggest it's probably something weird and specific. My main problem is I don't know even where to look/how to debug this kind of thing. If I build the app and run it on device again, it'll run fine. I need to try to debug without loading new code, and have no idea how that works on iOS. I've tried poking around at the Debug -> Attach to Process by Name, but the app never gets far enough to do anything with that.
Alternatively, I throw react-native in the garbage and use something that works...
App provisioning with a free developer license (?) is 7 days. See: Why does my free XCode Provisioning Profile only last 7 days?
You can likely verify this by looking at error messages in the console window. Connect your device, and in Xcode go to Window/Devices and Simulators/Open Console, then launch your app.

ios app-on-device debugging events

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.

App Submission fails but bug cannot be reproduced in debug mode in Corona SDK

We are having this weird issue related to submitting our app on iOS.
Basically when we build ( using developer profile ) and test ( via test flight ) everything works fine as expected even with most extensive test cases.
But when build ( using iOS distribution profile ) and submitted to apple ... in the review process it fails to pass due to a bug which we CANNOT REPRODUCE.
So, my best guess is that the bug/error is only happening in the release build ( probably due to code optimisation ) .. but I can't even know where and what to look for if I can't reproduce ?
I have submitted it the app twice so far ( with possible guess and fix ) and both time it came back with same error.
How do I test or even see the logs using a release build ? ( so far the DTS has been useless in providing any useful information)
/EDITED/
A bit more background info:
This is a game application made with Corona SDK. If you're familiar with corona sdk then you know what a scene is.
So basically,
I have a "home scene" I have an "open" button on my scene.
I click on the open button a spinner shows up->the app reads a json
file->goes to the next scene.
What apple is seeing in the review process is: Upon clicking on the "open button" on "home scene" the spinner shows up and it does not do anything further. Hence, the app is failing to pass apple's review process.
Please note: this only happens in the release mode (that is built with distribution profile) and not in debug mode ( that is built with provisioning profile )... thus I am unable to reproduce.
For starters, if your App was rejected due to a crash, Apple will send you the crash logs. And they'll crash it multiple times and send you multiple logs.
Now then, there are two ways to view crash logs for release build versions of apps.
On your device, open Settings. Choose General > About > Diagnostics & Usage > Diagnostics & Usage Data. This will be a list of files. Some of them should be your crash logs.
If you plug your phone into a computer after a crash, the crash logs are moved on to the computer.
The location is OS-specific.
On Mac OSX: ~/Library/Logs/CrashReporter/MobileDevice/<device name>/
On Win XP: C:\Documents and Settings\Application Data\Apple
computer\Logs\CrashReporter\<device name>\
On Win 7:
C:\Users\AppData\Roaming\Apple
computer\Logs\CrashReporter\MobileDevice\<device name>\
And finally, your IDE almost definitely has a way of browsing the on-device crash logs. I'm not familiar with any non-Xcode IDEs for developing iOS apps so I can't give any specific advice--but look around. Surely there's something.
You should also ask Apple to send you the console log from the run. Problems most likely will show up there.
Secondly, you should test using an AdHoc Distribution profile as well.

Resources