0

I am constructing a xcallBack Url like this

"\(scheme)://x-callback-url\(path)?x-source=ApName&ResponseData=\(base64str)"

and after constructing i had open url method

UIApplication.shared.open(callbackUrlN!) { (result) in
        if result {
           print("success")
        }
        else {
            print("cannot open url")
        }
    }

when my application is foreground state it is working fine, but when it enters into the background state instead of printing success i am getting "cannot open Url", Eventhough i had tried dispatch global background thread it is not working

Does anybody could help me out on this?

Mohan
  • 1
  • 1
  • Could you tell a bit more about what is your purpose? May be we could figure out how to achieve that using different way. – Nosov Pavel Feb 18 '21 at 08:43
  • I am passing an info from one app to other, so we had decided to go for the XCallBack, it is basically a gateway related app we had initiated a transaction from an app and passing the info to the other app, we do transaction and we give the info back to the originated one – Mohan Feb 18 '21 at 09:04

1 Answers1

0

I suppose that you are trying to call this acton with or without time interval after app goes to background, but iOS lifecycle make impossible to interact with app. If i'm not mistaken system gives short amount of time to finish your tasks, when your app goes to background, but you can extend your application lifetime and finish all the stuff using backgroundTask (system gives you about 3 min and then kill it), but it's still wouldn't help you to use callback.

Nosov Pavel
  • 1,571
  • 1
  • 18
  • 34