How to get crash logs for React Native app? - react-native

My React Native App crashed on a tester's phone.
What is the best way to get logs of that crash? I'm using React Native 0.14.2

We just rolled out official support for react native error reporting with Bugsnag this week which reports both JavaScript and native (Java/Cocoa) layer errors to a single dashboard.
Compared to Fabric - Bugsnag adds support for js source maps, ios symbolication, and android proguard mapping - which make a big difference.
Let me know if you have any questions or I can help in any way - I'm a founder.

As #Abhishek has commented, you'll have to use some monitoring tools with crashlytics to get such infomation.
Fabric is a good option in this case. It comes with a crashlytics solution.
Here is a blogpost that explains in-depth on how to set it up for your app.
Here's an excerpt of features of crashlytics tool of Fabric from the blogpost
Crash Reporting —It will record every single crash and its stack trace. This is way better than the iTunes Connect crash reports, which only include the info of users that opted in to share information with developers while setting up a new iPhone. It’s also not updated in real-time (you can read more about this here).
Crash Logs — (A.K.A. CLS_LOG) If you’re familiar with Objective-C, you have probably been using “NSLog” while you’re developing your app. You should use CLS_LOG instead. There’s no difference at all when you’re debugging (whatever you’re logging will still show up in the console) but the cool part is that when a user crashes your app, all the information will be sent to Crashlytics’s servers the next time the user launches your app, including all the content that you’ve logged through CLS_LOG. So if you log information for most of the actions/events in your app, you can read the logs later and reproducing the crash should be simple.

A good crash log framework that reports from the javascript level I've tried recently is Sentry. More descriptive with the actual error, if it comes from he JS side.

I wrote expo-error-log as a free alternative to BugSnag, etc.
Check it out if you like :
https://github.com/marchingband/expo-error-log
https://www.npmjs.com/package/expo-error-log
https://medium.com/#andymarch/free-error-reporting-in-expo-apps-with-expo-error-log-819cab5b6062

It seems like Crashlytics does the error reporting job perfect for a native app made in android/ios.
For a react-native app, however, Bugsnag looks more promising. You can explore both and see which one fits your requirements.

Related

Is it possible to collect info on why an app you created is crashing?

I have developed an Android app using react native.
When I run on simulator its fine, and also when I debug via USB on real device its fine.
However when I publish to Google Play store and download the app as a regular customer it sometimes crashes.
Are there any logs somewhere that I can refer to in order to identify what the issue is? Or perhaps there is something I can add to code to help identify where/why issue is occuring.
You can use log errors to do so, record the activity of user. When the app crashes, your app can ask the user to send the bug report.
Using that bug report you can understand why your app crashes.
You could also use tools like Sentry or Firebase Crashlytics with an Error Boundary
wrapping your app to report errors, allowing you to have a better understanding of the production errors by displaying the full error stack trace and a lot more.

Tool to remotely log (debug) React Native production app

Is there some tool available for React Native to remotely debug or send logs from production app to me?
I want to use it to track what errors my test users getting without them need to interact with app.
Have you thought about raygun? This gives you an api to log your errors and then a portal to view them. I use it on a project at work and it's worth looking at https://raygun.com/
There are a few options for you which will be quite easy for you to implement. The first one I would suggest you is react-native-firebase and use it for pushing events to the analytics in firebase.
The second option would be react-native-flurry-sdk offered by yahoo flurry analytics which is also very easy and efficient.
If your app is on google play store already then you can use the build in crash reporting system which reports most of the errors but if you need something specific and in your own control like if you want the app to send you a specific error etc then its best to use react-native-flurry-sdk. you can get it from here:
https://github.com/flurry/react-native-flurry-sdk

React Native - can it do these things efficiently?

We use React/Redux for our web-based app in production, and it works really-really well. We've been curious about React Native, and have a few quick questions. We're looking for facts only, not opinions, and not interested in starting a debate.
In order to build our app, we would need the following:
push notifications - I see a few projects on github, but does anyone have a robust solution running in production for a real app?
background processing - what happens when this app isn't running in the foreground (does background processing run similarly as other native apps, i.e. can I go to the Apple Setting app and disable the background worker threads?
web sockets - again, I've seen a few projects on github with experimental results, and yes I've heard that "this is trivial to implement, you just have to write a poly-fill". What I want is a drop-in solution, that's well tested.
in-app purchases - has anyone connected react native to Apple's in-app purchase system.
Thanks! I realize that react-native is in early beta, but in order for us to build an app efficiently, we need to make sure these basic things are ready to go.
Push notifications are included with React Native although the API is not as mature as core APIs like the view system.
React Native actually pauses some of its work when the app is backgrounded and background processing has not been a focus yet. You would instead want to delegate work to a dispatch queue. This might work for your use case if the background processing doesn't involve application logic, which you want to keep in JS.
WebSockets work reasonably well with React Native. Several contributors have helped build up WebSocket support. Out of your four requirements, I would say that WebSockets are the best supported.
There are npm packages like react-native-in-app-utils that expose the IAP APIs.

React native, do I need to send updates through app store?

Title pretty much explains it. Does it render JS from an external codebase so I can simply push new updates through git, or do I need to actually push the changes through App Store?
This is my previous answer, which is getting downvoted into oblivion because it didn't predict something cool like CodePush coming to React Native :)
React Native compiles to an iOS binary. Updates need to be sent to the
App Store, unless you're simply using React Native for its WebView
and rendering an existing webpage on the client.
Updated 6/2/16
It looks like Microsoft has a sweet plugin for CodePush found here that lets you push changes remotely to your React Native app without having to send the update through the App Store.
Here's a quote from the README docs:
NOTE: While Apple's developer agreement fully allows performing
over-the-air updates of JavaScript and assets (which is what enables
CodePush!), it is against their policy for an app to display an update
prompt. Because of this, we recommend that App Store-distributed apps
don't enable the updateDialog option when calling sync, whereas Google
Play and internally distributed apps (e.g. Enterprise, Fabric,
HockeyApp) can choose to enable/customize it.
I'm actually working on a project (with the React Native Playground team - https://rnplay.org/about) that will allow you do live update your apps JS on the fly without submitting an update to the App Store. It's called Reploy, http://reploy.io
We will be open-sourcing the first portion of it very soon (the updater module). There will also be a service that will help you to manage your updates and even deploy your app to TestFlight and the App Store when needed (App Store updates are still needed when adding a new native module or static assets).
Also, just so you know, Apple has allowed this type of auto-updating via item 3.3.2 in the "iOS Developer Program Requirements" document, it says:
3.3.2 An Application may not download or install executable code. Interpreted
code may only be used in an Application if all scripts, code and interpreters are
packaged in the Application and not downloaded. The only exception to the
foregoing is scripts and code downloaded and run by Apple's built-in WebKit
framework or JavascriptCore, provided that such scripts and code do not change
the primary purpose of the Application by providing features or functionality that are
inconsistent with the intended and advertised purpose of the Application as
submitted to the App Store.
https://developer.apple.com/programs/ios/information/iOS_Program_Information_4_3_15.pdf
You could push an update to a remote user if you had linked to an external bundle and had the IP / correct ports forwarded, however Apple do not allow this for released AppStore apps.
For beta testing remote apps you might want to try exponent http://exp.host/
Update---
For completeness, it should be noted that if you are part of the Apple Enterprise program you do not need to publish Apps to the AppStore at all, you can post them to end users via a download link.
I work on a project called AppHub that lets you update JavaScript and images without re-submitting to the App Store. The iOS SDK will be open source, but for now you can use the hosted service to manage new builds of your app.

iOS App Settings/Preferences in Worklight

I am working on a Hybrid Application, targeting (for the moment) iOS. Does Worklight have a utility to handle application settings/preferences for iOS? I know how to write the native code to do this, but do not yet know how to gain access to the application settings from the JavaScript. Can anyone point me in the right direction or provide a working example?
In application-descriptor.xml, there is a worklightSettings flag you can set, however the settings page it creates is not user facing. That is, it is meant only for development time, or internal usage, and not production. It allows control of the server address that athe client connects to and change the web resources it will fetch.
So the answer is, no.
The mentioned settings page has set items in it that cannot be altered much (settings.bundle which does not allow much room for play. Maybe you could change it a bit, but doing so would void giving support to you if problems arise). I would recommend against doing so.
So this leaves you the option of creating this on your own. Maybe there is an existing Cordova plug-in that does something similar. Review these training modules of how to incorporate Cordova plug-ins to your application. Cordova bridges between JavaScript to native code, so it could be what you're looking for.