0

I am using Phonegap/Cordova 3.4.0 for an iPhone/iPad app. I use the Media and the Dialogs plugins. They work just fine on the iPad, but on the iPhone the sound doesn't play and the notifications don't appear when I press the respective buttons. However, if I double tap the home button (or if I minimize the app and maximize it again), all sounds start playing at the same time and the notifications I was trying to trigger get shown as well.

It's a very weird delayed response, and I have found nothing about this issue. Can anyone help please?

Best regards

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Costin_T
  • 786
  • 1
  • 8
  • 27

1 Answers1

0

I found the culprit. I had added a bit of code so that I can open external links in Safari. So it was this code in MainViewController.m:

// BEGIN - Custom code
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

    NSURL *requestURL =[ request URL ];
    if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL scheme ] isEqualToString: @"https" ] || [ [ requestURL scheme ] isEqualToString: @"mailto" ]) )
    {
        [[UIApplication sharedApplication] openURL: requestURL];
        return NO;
    }

    return YES;

}
// END - Custom code

Instead of the return YES; at the end, I had to replace it with:

return [super webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];

And everything worked!

Costin_T
  • 786
  • 1
  • 8
  • 27