Permalink
Browse files

Merge pull request #5 from shazron/plugin-fix-5

Updated handleOpenURL to wrap the callback in a setTimeout
  • Loading branch information...
2 parents 3753776 + d3f7ce5 commit 8f20b3a4aba5b770c9ec81543e853abb64fb0b66 Dave Johnson committed Jul 12, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 native/ios/FacebookConnectPlugin.m
@@ -42,7 +42,9 @@ - (void) handleOpenURL:(NSNotification*)notification
PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageAsDictionary:status];
- [super writeJavascript:[result toSuccessCallbackString:self.loginCallbackId]];
+ NSString* callback = [result toSuccessCallbackString:self.loginCallbackId];
+ // we need to wrap the callback in a setTimeout(func, 0) so it doesn't block the UI (handleOpenURL limitation)
+ [super writeJavascript:[NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", callback]];
}
}

0 comments on commit 8f20b3a

Please sign in to comment.