You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/03/07 01:18:16 UTC
[03/43] ios commit: CB-7182 - Running mobile-spec in an iOS 8 project
but using UIWebView results in an exception
CB-7182 - Running mobile-spec in an iOS 8 project but using UIWebView results in an exception
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/6d6ab0a1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/6d6ab0a1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/6d6ab0a1
Branch: refs/heads/4.0.x
Commit: 6d6ab0a161f93eee92faa1d3888318e3144e6f29
Parents: 28b4475
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jul 21 14:02:43 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jul 21 14:02:43 2014 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVCommandQueue.m | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6d6ab0a1/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index b4f1fa6..bb2788b 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -109,25 +109,19 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
- (void)fetchCommandsFromJs
{
+ __weak CDVCommandQueue* weakSelf = self;
NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
- SEL ui_selector = NSSelectorFromString(@"stringByEvaluatingJavaScriptFromString:");
- // Grab all the queued commands from the JS side.
- NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:
- [[_viewController.webView class] instanceMethodSignatureForSelector:ui_selector]];
-
- [invocation setSelector:ui_selector];
- [invocation setTarget:_viewController.webView];
- // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
- [invocation setArgument:&(js) atIndex:2];
-
- [invocation invoke];
-
- NSString* queuedCommandsJSON;
- [invocation getReturnValue:&(queuedCommandsJSON)];
-
- CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
- [self enqueueCommandBatch:queuedCommandsJSON];
+ [_viewController.webViewOperationsDelegate evaluateJavaScript:js
+ completionHandler:^(id obj, NSError* error) {
+ if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
+ NSString* queuedCommandsJSON = (NSString*)obj;
+ CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
+ [weakSelf enqueueCommandBatch:queuedCommandsJSON];
+ // this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous)
+ [self executePending];
+ }
+ }];
}
- (void)executePending
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org