Note that there are some explanatory texts on larger screens.

plurals
  1. POAFHTTPRequestOperation doesn't work after stand by mode
    text
    copied!<p>I am developing a app which upload multiple files. For uploading, I use <code>AFHTTPRequestOperation</code>. It successfully works, But If I lock and after it unlock the screen,then It stop uploading files.</p> <p>My code for upload file is here</p> <pre><code>NSUserDefaults *defaultUser = [NSUserDefaults standardUserDefaults]; NSString *userId = [defaultUser stringForKey:@"UserId"]; AFHTTPClient *client= [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",UploadURL,userId]]]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:nil]; NSMutableURLRequest *request = [client multipartFormRequestWithMethod:@"POST" path:nil parameters:params constructingBodyWithBlock: ^(id &lt;AFMultipartFormData&gt;formData) { [formData appendPartWithFileData: data name:@"f" fileName:[NSString stringWithFormat:@"%d_image.jpeg",rand()] mimeType:@"image/jpeg"]; }]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {}]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"error: %@", [operation error]); if(error.code == -1001){ UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Error!" message:@"The request timed out." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [myAlert show]; } }]; [operation start]; </code></pre> <p>Can anyone give me suggestion for handle this situation.</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload