Created
October 3, 2012 01:08
-
-
Save yonekawa/3824310 to your computer and use it in GitHub Desktop.
Fix PhoneGap2.1-iOS does not work with RequireJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m | |
index a0a29f0..520050d 100644 | |
--- a/CordovaLib/Classes/CDVViewController.m | |
+++ b/CordovaLib/Classes/CDVViewController.m | |
@@ -510,7 +510,7 @@ | |
// The iOSVCAddr is used to identify the WebView instance when using one of the XHR js->native bridge modes. | |
// The .onNativeReady().fire() will work when cordova.js is already loaded. | |
// The _nativeReady = true; is used when this is run before cordova.js is loaded. | |
- NSString* nativeReady = [NSString stringWithFormat:@"cordova.iOSVCAddr='%lld';try{cordova.require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}", (long long)self]; | |
+ NSString* nativeReady = [NSString stringWithFormat:@"window.iOSVCAddr='%lld';try{cordova.require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}", (long long)self]; | |
[theWebView stringByEvaluatingJavaScriptFromString:nativeReady]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cordova/www/cordova-2.1.0.js b/cordova/www/cordova-2.1.0.js | |
index db81edf..c863b57 100755 | |
--- a/cordova/www/cordova-2.1.0.js | |
+++ b/cordova/www/cordova-2.1.0.js | |
@@ -972,7 +972,7 @@ function iOSExec() { | |
// Changeing this to a GET will make the XHR reach the URIProtocol on 4.2. | |
// For some reason it still doesn't work though... | |
execXhr.open('HEAD', "file:///!gap_exec", true); | |
- execXhr.setRequestHeader('vc', cordova.iOSVCAddr); | |
+ execXhr.setRequestHeader('vc', window.iOSVCAddr); | |
if (shouldBundleCommandJson()) { | |
execXhr.setRequestHeader('cmds', nativecomm()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! That saved my day :)