简体   繁体   中英

ASIHTTPREQUEST gives error (1) when iPhone is locked and unlocked

I am using ASIHTTPREQUEST to do asynchronous network connections in my app. For the most part it works great. However, if I am running a connection, and lock the phone (but leave the app open), and the unlock it, I get the following error on my connections:

ErrorDomain=ASIHTTPREQUESTErrorDomain Code=1 "The operation could not be completed." (ASIHTTPREQUESTErrorDomain error 1.)

How can I stop this from happening, or even make the HTTP requests continue to work even if the phone has been locked or the screen shuts off?

Start a background task with UIApplication 's beginBackgroundTaskWithExpirationHandler: method before initiating the request. End the background task when the request returns with success or failure and you have processed the data from the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM