【发布时间】:2013-06-26 08:20:48
【问题描述】:
我实现了从 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。 警报视图 你能帮帮我吗?
【问题讨论】:
-
当我按下按钮取消时它不起作用。什么不起作用?有日志吗?
-
定义不工作。如您所知,该操作可能在分配给该按钮的操作触发之前完成。
-
无法停止上传过程。@Rob
标签: iphone ios objective-c afnetworking nsoperation