我正在使用 asihhtp 请求在 ios 中发出多个图像上传请求以将图像提交到服务器。但是由于进度条,我的应用程序总是崩溃。这是我的代码
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlStr]];
[request appendPostData:postData];
[request setTag:[[dic objectForKey:@"unique"] integerValue]];
[request setDelegate:self];
[request setUploadProgressDelegate:cell.mProgressBar];
[request setDidFailSelector:@selector(requestFail:)];
[request setDidFinishSelector:@selector(requestDone:)];
[request setRequestMethod:@"POST"];
[request addRequestHeader:@"Content-Type" value:@"text/plain"];
[request setShouldContinueWhenAppEntersBackground:YES];
//[myQueue addOperation:request];
[appDelegate window].userInteractionEnabled = NO;
[request startAsynchronous];
我有自定义单元格,其中有进度条和标签,因此一旦过程完成,我将隐藏栏并显示已完成的标签。
用户滚动表应用程序崩溃使用进度条时出现问题
崩溃输出
> -[UIProgressView respondsToSelector:]: message sent to deallocated instance 0x10d210c0
自定义单元格代码
#import <UIKit/UIKit.h>
@interface CustomProgressBar : UITableViewCell
{
}
@property (retain, nonatomic) IBOutlet UILabel *mlblCompllrtrlbl;
@property (retain, nonatomic) IBOutlet UIProgressView *mProgressBar;
@property (retain, nonatomic) IBOutlet UIImageView *mCellImafge;
@end
自定义单元格代码
#import "CustomProgressBar.h"
@implementation CustomProgressBar
@synthesize mlblCompllrtrlbl;
@synthesize mProgressBar;
@synthesize mCellImafge;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)dealloc
{
[mCellImafge release];
[mlblCompllrtrlbl release];
[mProgressBar release];
[super dealloc];
}
@end