Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ios app crash when the Cordova agent receives responses in the f… #86

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

# 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.
* Similarly, the native Android agent has been upgraded to version 7.3.1, improving stability and introducing new features.


# 6.2.8
*
* Updated native iOS Agent: We've upgraded the native iOS agent to version 7.4.10, which includes performance improvements and bug fixes.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newrelic-cordova-plugin",
"version": "6.2.8",
"version": "6.2.9",
"description": "New Relic Cordova Plugin for iOS and Android",
"repo": "https://github.com/newrelic/newrelic-cordova-plugin/",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="newrelic-cordova-plugin" version="6.2.8">
id="newrelic-cordova-plugin" version="6.2.9">
<name>NewRelic</name>
<description>New Relic Cordova Plugin for iOS and Android</description>
<author>New Relic</author>
Expand All @@ -18,7 +18,7 @@
<engine name="cordova-android" version=">=5.0.0" />
</engines>

<preference name="PLUGIN_VERSION" default="6.2.8" />
<preference name="PLUGIN_VERSION" default="6.2.9" />
<preference name="CRASH_REPORTING_ENABLED" default="true" />
<preference name="DISTRIBUTED_TRACING_ENABLED" default="true" />
<preference name="INTERACTION_TRACING_ENABLED" default="true" />
Expand Down Expand Up @@ -73,7 +73,7 @@
<source url="https://cdn.cocoapods.org/" />
</config>
<pods use-frameworks="true">
<pod name="NewRelicAgent" spec="7.4.10" />
<pod name="NewRelicAgent" spec="7.4.11" />
</pods>
</podspec>

Expand All @@ -83,7 +83,7 @@

<platform name="android">
<preference name="ANDROID_APP_TOKEN" default="x" />
<preference name="ANDROID_AGENT_VER" default="7.3.0" />
<preference name="ANDROID_AGENT_VER" default="7.3.1" />

<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
4 changes: 2 additions & 2 deletions src/android/NewRelicCordovaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
traceHeadersMap = new Gson().fromJson(String.valueOf(traceAttributes), Map.class);
}

JSONObject params = args.getJSONObject(8);
Object params = args.get(8);
Map<String,String> paramsMap = new HashMap<>();
if (params != null) {
if (params instanceof JSONObject) {
paramsMap = new Gson().fromJson(String.valueOf(params), Map.class);
}

Expand Down
23 changes: 21 additions & 2 deletions src/ios/NewRelicCordovaPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,30 @@ - (void)noticeHttpTransaction:(CDVInvokedUrlCommand *)command {
NSNumber* bytesreceived = [command.arguments objectAtIndex:6];
NSString* body = [command.arguments objectAtIndex:7];

NSDictionary* params;
if([command.arguments objectAtIndex:8] == [NSNull null] ){
params = nil;
}
else {params = [command.arguments objectAtIndex:8];
}

NSDictionary* traceAttributes;
if([command.arguments objectAtIndex:9] == [NSNull null] ){
traceAttributes = nil;
}
else {
traceAttributes = [command.arguments objectAtIndex:9];
}

NSURL *nsurl = [NSURL URLWithString:url];
NSData* data = [body dataUsingEncoding:NSUTF8StringEncoding];
NSData* data;
if (body == [NSNull null]) {
data = nil;
} else {
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:nil andParams:nil];
[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];
}

- (void)crashNow:(CDVInvokedUrlCommand *)command {
Expand Down
Loading