File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
iOS_SDK/OneSignalSDK/Source Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,16 @@ -(void)attachBodyToRequest:(NSMutableURLRequest *)request withParameters:(NSDict
101101 }
102102
103103 NSError *error;
104- NSData *jsonData = [NSJSONSerialization dataWithJSONObject: parameters options: NSJSONWritingPrettyPrinted | NSJSONWritingWithoutEscapingSlashes error: &error];
104+ if (@available (iOS 13 , *))
105+ request.HTTPBody = [NSJSONSerialization dataWithJSONObject: parameters options: NSJSONWritingWithoutEscapingSlashes error: &error];
106+ else {
107+ NSData * requestData = [NSJSONSerialization dataWithJSONObject: parameters options: 0 error: &error];
108+ NSString * requestString = [[NSString alloc ] initWithData: requestData encoding: NSUTF8StringEncoding];
109+ requestString = [requestString stringByReplacingOccurrencesOfString: @" \\ /" withString: @" /" ];
110+ requestData = [requestString dataUsingEncoding: NSUTF8StringEncoding];
105111
106- request.HTTPBody = jsonData;
112+ request.HTTPBody = requestData;
113+ }
107114}
108115
109116-(void )attachQueryParametersToRequest : (NSMutableURLRequest *)request withParameters : (NSDictionary *)parameters {
You can’t perform that action at this time.
0 commit comments