From af7614f5e01d8eea39f924f547dc82304efede21 Mon Sep 17 00:00:00 2001 From: "Peter (Somogyvari) Metz" Date: Sat, 2 Jul 2016 23:05:39 +0100 Subject: [PATCH] cordova-ios 4.x compatibility The "writeJavascript" method doesn't exist on CDVPlugin anymore. Updated the code to write the receiveHook JS snippet in a different way (for the same outcome) --- src/ios/CDVSocketPlugin.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVSocketPlugin.m b/src/ios/CDVSocketPlugin.m index 1dd6e72..4335dac 100644 --- a/src/ios/CDVSocketPlugin.m +++ b/src/ios/CDVSocketPlugin.m @@ -345,7 +345,14 @@ - (void) sendMessage :(NSString *)host :(int)port :(NSString *)chunk { NSString *receiveHook = [NSString stringWithFormat : @"window.tlantic.plugins.socket.receive('%@', %d, '%@', '%@' );", host, port, [self buildKey : host : port], [NSString stringWithString : data]]; - [self writeJavascript:receiveHook]; + [self.webViewEngine evaluateJavaScript:receiveHook completionHandler:^(id result, NSError *anError) { + if (anError) { + NSLog(@"ERROR: Failed to execute the receive hook for CDVSocketPlugin: %@", [anError localizedDescription]); + } else { + NSLog(@"Receive hook JS code returned with: %@", result); + } + + }]; } -@end \ No newline at end of file +@end