File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,14 @@ - (void)initSession:(CDVInvokedUrlCommand*)command
94
94
}
95
95
else {
96
96
NSLog (@" Init Error: %@ " , [error localizedDescription ]);
97
- resultString = [NSString stringWithFormat: @" Init Error: %@ " , [error localizedDescription ]];
97
+
98
+ // We create a JSON string result, because we're getting an error if we directly return a string result.
99
+ NSDictionary *errorDict = [NSDictionary dictionaryWithObjectsAndKeys: [error localizedDescription ],@" error" , nil ];
100
+ NSData * errorJSON = [NSJSONSerialization dataWithJSONObject: errorDict
101
+ options: NSJSONWritingPrettyPrinted
102
+ error: &error];
103
+
104
+ resultString = [[NSString alloc ] initWithData: errorJSON encoding: NSUTF8StringEncoding];
98
105
}
99
106
NSLog (@" returning data to js interface.." );
100
107
[self .commandDelegate evalJs: [NSString stringWithFormat: @" DeepLinkHandler(%@ )" , resultString]];
You can’t perform that action at this time.
0 commit comments