Does X-CallBack work in Background thread?

105 Views Asked by At

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?

1

There are 1 best solutions below

0
Nosov Pavel On

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.