0

I was wondering if it is possible to launch safari directly after opening an App through a push notification, so I implemented the following in my didReceiveRemoteNotification:

if (UIApplication.shared.applicationState == .active) {
// This works
UIApplication.shared.open(someurl , options: [ : ], completionHandler: nil)

} else if (UIApplication.shared.applicationState == .inactive) {
//Nothing happens
UIApplication.shared.open(someurl , options: [ : ], completionHandler: nil)

} else if (UIApplication.shared.applicationState == .background) {
//Nothing happens
UIApplication.shared.open(someurl , options: [ : ], completionHandler: nil)
}

I can put print statements or anything else in the .inactive or .background states which do get called, so the methods do get called. However the last 2 states are not opening Safari, nothing happens.

Question: Is this intended, or am I missing something here?

ffritz
  • 2,180
  • 1
  • 28
  • 64

0 Answers0