openURL is not working when App is in background i

2019-05-13 22:17发布

问题:

I am trying to open one URL in Safari from my App when App is in background, below is my code

    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:strURL]];

My App is hiting the above line during debugging, but not opening Safari with the given URL.

回答1:

It's not possible, You cannot launch another app from the background state. If app in background then you can't have any event for handle your app event from iPhone/iPad screen. You must have to wake up your app. You can use local notifications.