我实现了从 uiimagepickercontroller 到服务器的应用程序上传图像。但我想在上传过程中实现取消按钮来取消上传。
在上传功能中:
[operation setCompletionBlock:^{
ProgressView.hidden = YES;
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Uploading successfull." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[av show];
[av release];
overlayToolbar.userInteractionEnabled = YES;
NSLog(@"response string: %@", operation.responseString); //Lets us know the result including failures
}];
NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
[queue addOperation:operation];
和按钮取消:
[httpClient.operationQueue cancelAllOperations];
当我按下按钮取消时,它没有停止上传过程,然后出现alertview“上传成功”。我不知道为什么不能停止但仍然出现alertview。alertview 你能帮帮我吗?