[AC-6167] iOS New Relic module not able to post crash report
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Needs more info |
Resolution Date | 2019-05-01T22:26:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | eric harms |
Assignee | Shak Hossain |
Created | 2019-03-11T23:12:25.000+0000 |
Updated | 2019-05-01T22:26:19.000+0000 |
Description
Hi,
I am developing a module for New Relic to report crashes. I've attached a few sample projects at the bottom of this ticket, Native App sample xcode project and my module xcode project.
If I run the native app, I can see the crashes report as expected. The app fully crashes.
However when I do the same thing in the Appc sample app using the module, I see the Appc red error screen, and the crash is not reported in New Relic's dashboard. I and my colleague believe that Appc is catching the crash and not letting it propagate to where it needs to go.
*To test and recreate:*
1. Open a test account with New Relic at https://newrelic.com/signup?via=login
2. Follow the installation guide, chose iOS, and create a test app for your dashboard. Scroll down to the bottom of the screen to "Activate mobile apps" (green button).
3. once that is set up, you should be able to click the green area in the header and select Mobile, and you will see a dashboard.
At this point you'll need your Application Token, which can be found by clicking the Installation link at the left again. You'll see your token on the right.
*Test iOS Native app sample*
1. In my attached native app sample (see dropbox links below), paste your application token in the AppDelgate.m, line 21, in the placeholder.
2. Also paste the token in the project Run Script in Build Phases. This is not necessary, it is supposed to upload the dSYM after building.
3. Build and run to a device. In a few minutes you should see in your New Relic dashboard a registered app launch. Back in the app, if you click the "Button" it should crash the app, and in a minute or so you should see the crash registered in the New Relic dashboard.
4. If you view the crash you can upload the dSYM for the build here to de-obfuscate the error, but not necessary.
*Test Appc sample app:*
1. Add your Application Token to the XcodeModuleProject and build the module.
2. Create a new test app, and install the module. In Index.js, change the boilerplate to:
var nr = require("com.newrelic");
function doClick(e) {
nr.crash();
}
$.index.open();
3. run the app on a device or simulator and click the Hello World label. This should simulate a New Relic crash, and you'll see the Appc red error screen, it should say "Forcing crash in new relic module" which is being logged in the module. The app itself will not fully crash as it does in the native sample app.
It is here that I think Appc is catching the crash and not letting it propagate to the New Relic module's SDK.
Please let me know if someone might be able to tell me why I am not seeing the Appc sample app crash being reported in the New Relic dashboard. My colleague and I feel that we've implemented the module correctly, but can't figure out why the crash is not registering with the dashboard.
*Source files:*
Native ios xcode project
https://www.dropbox.com/s/jzv5vs4rmb8vd3o/NativeIosProject.zip?dl=0
Module xcode project
https://www.dropbox.com/s/8wl0e6xfhxmp1oi/XcodeModuleProject.zip?dl=0
Thanks!
Hi, we've remedied this one by substituting New Relic's test crash method with the following, which seems to bypass Appcelerator and let us post the crash to New Relic. Is there a reason why this gets through?
The error is throwing on the native side of a JS function. We catch such errors and convert them to a JS error instead. You can see the behavior with the following code:
I assume NewRelic uses the top-level handler for uncaught exceptions to do their reporting. In this case the exception is actually caught by us so NewRelic can't report anything. You can try and hook into our exception handler and manually record the exception using our [TiExceptionHandlerDelegate](https://github.com/appcelerator/titanium_mobile/blob/b0726db82ba7b70a1a021df8bd8c7ad84aab9717/iphone/TitaniumKit/TitaniumKit/Sources/API/TiExceptionHandler.h#L57) and [recordHandledException](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/ios-sdk-api/record-handled-exception):
and then implement the following delegate methods:
Hope this helps! Would be great to see NewRelic support again ;)
[~eric.harms@gmail.com], I thought I’d check in to see how things are progressing with your need? Just following up to check the status of this case and if you need further help on it. Please let us know if the problem persists. Have a great day.