iOS PhoneGap ChildBrowser “data argument not used by format string” warnings with XCode 4.4

StackOverflow https://stackoverflow.com/questions/11743284

  •  23-06-2021
  •  | 
  •  

Вопрос

I've updated XCode to v4.4 and started getting warnings in the PhoneGap (Cordova 1.9.0) ChildBrowser plug-in that never showed up with v4.3. (Nothing else in my code changed.) When I saw these warnings, I pulled the latest version of the ChildBrowser plugin and that didn't make the warnings go away, either.

Anyway... in ChildBrowserCommand.m:

-(void) onClose
{
    NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onClose();",@""];
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
}

-(void) onOpenInSafari
{
    NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onOpenExternal();",@""];
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
}

Each of these give a "Data argument not used by format string" warning. This makes sense since there's no place for the @"" to be placed into the format string even if it had a value.

I'm no Objective-C expert but realize I can get rid of the warning by deleting the ,@"" in the call.

Just posting in case anyone can explain why this started showing up after updating to XCode 4.4 and whether/how this should be flagged as an issue with the iOS PhoneGap ChildBrowser plugin on GitHub.

Это было полезно?

Решение

I had the same problem and i have to admit I did not notice your answer so: I have no idea why this fix it and will be happy to know but this is the fix. To fix this use the following code:

-(void) onClose
{
    NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onClose();"];
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
}

-(void) onOpenInSafari
{
    NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onOpenExternal();"];
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top