Reputation: 2209
MeteorJS: https://github.com/zeroasterisk/Presenteract
PhoneGap: https://github.com/zeroasterisk/Presenteract-PhoneGap-ios
config.xml
as the <content src="http://presenteract.meteor.com" />
access
config is setup with a full wildcard <access origin="*" />
But when I attempt oAuth from within PhoneGap, I end up with the following error:
Failed to load webpage with error: The operation couldn’t be completed.
(NSURLErrorDomain error -999.)
(NOTE: oAuth attempts from Google, Facebook, and Twitter are all the same. Loads external site, login proceeds as normal, and upon redirect back to my application's main URL)
I have looked through other StackOverflow reports and done some googeling... The most useful one I found is:
Facebook dialog failed with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.) & Related: NSURLErrorDomain error -999 - links failing in iOS
This seems very promising, but I don't know how to translate this solution into PhoneGap...
I Found the following stub, in <projectname>/Classes/MainViewController.m
and I have played with it a bit, but to no solution yet....
- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
{
/* (this does log to the console, but doesn't tell me anything different)
* still: theWebView webView didFailLoadWithError:NSURLErrorDomain -999
*/
NSLog(@"theWebView webView didFailLoadWithError:%@ %d",error.domain,error.code);
/* (this is commented out, it didn't seem to do anything for me) */
if ([error.domain isEqualToString:@"NSURLErrorDomain"] && error.code == -999) {
NSLog(@"theWebView webView caught the error=-999... but returning void doesn't force the page to reload/continue:%@ %d",error.domain,error.code);
return;
}
/* (this was already here, part of PhoneGap) */
return [super webView:theWebView didFailLoadWithError:error];
}
I get the second "caught the error=-999" log message, but I end up in a white screen on the app still.
Upvotes: 1
Views: 2431
Reputation: 1008
I hit the same error when I upgraded from Cordova (PhoneGap) 2.2 to 2.7.
Looking at your description, I cannot readily tell if it is the same problem. But, I thought sharing my solution / workaround might help.
The problem I hit was that Cordova 2.7 didn't handle client side redirect during startup correctly.
I also tried to play around MainViewController.m
, but I didn't believe the problem can be worked around there.
My solution was to modified CordovaLib/Classes/CDVWebViewDelegate.m
to handle the redirect case.
Here is my pull-request:
https://github.com/apache/cordova-ios/pull/57/files
Upvotes: 2