From 82e88f574d18ffcf5cbcdf71b5776b69eddc9075 Mon Sep 17 00:00:00 2001 From: Majeed Date: Tue, 14 May 2024 14:29:52 +0200 Subject: [PATCH] fix: prevent app crash when uploading images --- CHANGELOG.md | 3 +++ src/ios/NewRelicCordovaPlugin.m | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25e4b81..8e79ef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +# unreleased +* Add try/catch block to prevent app crash when image is uploaded + # 6.2.9 * A crash issue in the iOS app has been resolved when the Cordova agent receives responses in the form of blobs or array buffers. * The native iOS agent has been updated to version 7.4.11, which brings performance enhancements and bug fixes. diff --git a/src/ios/NewRelicCordovaPlugin.m b/src/ios/NewRelicCordovaPlugin.m index 351fbb3..8bd2293 100644 --- a/src/ios/NewRelicCordovaPlugin.m +++ b/src/ios/NewRelicCordovaPlugin.m @@ -287,7 +287,11 @@ - (void)noticeHttpTransaction:(CDVInvokedUrlCommand *)command { data = [body dataUsingEncoding:NSUTF8StringEncoding]; } - [NewRelic noticeNetworkRequestForURL:nsurl httpMethod:method startTime:[startTime doubleValue] endTime:[endTime doubleValue] responseHeaders:nil statusCode:(long)[status integerValue] bytesSent:(long)[bytesSent integerValue] bytesReceived:(long)[bytesreceived integerValue] responseData:data traceHeaders:traceAttributes andParams:params]; + @try { + [NewRelic noticeNetworkRequestForURL:nsurl httpMethod:method startTime:[startTime doubleValue] endTime:[endTime doubleValue] responseHeaders:nil statusCode:(long)[status integerValue] bytesSent:(long)[bytesSent integerValue] bytesReceived:(long)[bytesreceived integerValue] responseData:data traceHeaders:traceAttributes andParams:params]; + } @catch (NSException * e) { + + } } - (void)crashNow:(CDVInvokedUrlCommand *)command {