Fix compilation error of wkwebview-engine when DEBUG macro is defined.

Project: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/1dbc2426
Tree: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/1dbc2426
Diff: 
http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/1dbc2426

Branch: refs/heads/master
Commit: 1dbc24263e35bf8793c8025e74911a0042ab7a72
Parents: fa97a17
Author: Shazron Abdullah <shaz...@apache.org>
Authored: Fri May 29 16:14:24 2015 -0700
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Fri May 29 16:14:24 2015 -0700

----------------------------------------------------------------------
 src/ios/CDVWKWebViewEngine.m | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/1dbc2426/src/ios/CDVWKWebViewEngine.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVWKWebViewEngine.m b/src/ios/CDVWKWebViewEngine.m
index d7c2d78..fa0ce26 100644
--- a/src/ios/CDVWKWebViewEngine.m
+++ b/src/ios/CDVWKWebViewEngine.m
@@ -205,13 +205,22 @@
 
     if (![vc.commandQueue execute:command]) {
 #ifdef DEBUG
-            NSString* commandJson = [jsonEntry JSONString];
+        NSError* error = nil;
+        NSString* commandJson = nil;
+        NSData* jsonData = [NSJSONSerialization dataWithJSONObject:jsonEntry
+                                                           options:0
+                                                             error:&error];
+        
+        if (error == nil) {
+            commandJson = [[NSString alloc] initWithData:jsonData 
encoding:NSUTF8StringEncoding];
+        }
+
             static NSUInteger maxLogLength = 1024;
             NSString* commandString = ([commandJson length] > maxLogLength) ?
                 [NSString stringWithFormat : @"%@[...]", [commandJson 
substringToIndex:maxLogLength]] :
                 commandJson;
 
-            DLog(@"FAILED pluginJSON = %@", commandString);
+            NSLog(@"FAILED pluginJSON = %@", commandString);
 #endif
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to