IOS如何在恢复应用程序时上传PFFile,例如当被电话打断时?

时间:2014-04-29 14:32:34

标签: ios iphone file-upload resume

以下是我上传文件的代码。当应用程序放在后台时会完全取消,所以有任何内置的PFFile函数可以解决这个问题,这将是最简单的解决方案。

PFFile * file = [PFFile fileWithName:filetoUpload data:data];
        [file saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {

            //Something bad has ocurred
        if (![self CheckConnection])

         {
                UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"The Internet connection appears to be offline " delegate:self
                                                               cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
                [errorAlertView show];
            [errorAlertView release];

              [file cancel];
            }
}

0 个答案:

没有答案