AFNetworking background file upload

前端 未结 1 834
孤独总比滥情好
孤独总比滥情好 2021-01-02 10:25

I want to upload files to my server from my app. The code below is working great when app is active. If I press home button or open another app uploading stops.

I a

相关标签:
1条回答
  • 2021-01-02 11:09

    Change this line

    [operation start];
    

    to this

    [operation setShouldExecuteAsBackgroundTaskWithExpirationHandler:^{
            // Handle iOS shutting you down (possibly make a note of where you
            // stopped so you can resume later)
        }];
    
    
        [manager.operationQueue addOperation:operation];
    

    You can look at these links AFHTTPRequestOperation doesn't work after stand by mode and Alternative for enqueueHTTPRequestOperation in AFNetworking 2.0

    0 讨论(0)
提交回复
热议问题