In my iOS 4 application, I need to open a URL from the background, at a time specified from the user. However, for some reason, I cannot launch a URL from the background for some reason. Here is my code for opening a URL:
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.stackoverflow.com"]])
{
// the URL wasn't opened. we will ignore this for now.
}
That code is all being launched from a daemon thread created earlier. I have tested this code on the simulator, and the URL is not opened, and the method returns YES
for some reason, but when I open my application again (via fast-app-switching) it opens the URL. Is there some way that I can make my application come to the foreground again at this point (not via a local notification) so that the URL may open, or is this a bug or undocumented feature. Also, if there is another way to open the URL, that will work in the background, that would be helpful too.