HomeiOS Developmentswift - iOS : Challenge in accessing web when app is launched...

swift – iOS : Challenge in accessing web when app is launched from BGAppRefreshTask |BGProcessingTask


Use case : We wish to replace our app content material whereas the app is within the background. We wish to obtain some json knowledge from our backend server(HTTP GET) and replace the content material of the applying in order that subsequent time when person launches the app he see up to date content material. We’re utilizing apple’s BackgroundTasks framework API, specifically BGAppRefreshTask and BGProcessingTask. Fairly normal

Downside → HTTP request through URLSession doesn’t work.

We register and schedule BGAppRefreshTask and BGProcessingTask. Our utility is launched within the background by iOS. However after we make an HTTP request to an online server, we don’t get any response callback.
With default configuration, after making the request the response callback or the URLSessionDataDelegate strategies aren’t referred to as in any respect. (I additionally tried with google url. simply to make certain the issue isn’t solely with our backend) .
Each factor works superb after I verify complete stream whereas debugging and I’m related to Xcode and set off a background launch by utilizing this command
e -l objc — (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@”com.background_cloud_sync_apprefresh”]
I’m sort of caught with this subject and have run out of concepts to attempt.
So I’m reaching out to professional right here if in case you have confronted any such subject on iOS.

I’ve tried URLSession with callback in addition to with URLSessionDataDelegate.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments