嗨,我遇到了 NSOperation 的一些问题。我总是在self = [super init];
(已经使用断点找到它)出错它总是返回“程序接收信号:EXC_BAD_ACCESS”
//AddThread.h
@interface AddThread : NSOperation
{
NSString * str;
}
@property (nonatomic,retain) NSString * str;
-(id) initWithString:(NSString *) tmpStr;
@end
对于.m
//AddThread.m
#import "AddThread.h"
@implementation AddThread
@synthesize str;
- (id) initWithString:(NSString *)tmpStr
{
self = [super init];
if (self != nil)
{
self.str = tmpStr;
}
//NSLog(self);
//[super init];
return self;
}
- (void) main
{
NSLog(self.str);
}
- (void) dealloc{
[str release];
str = nil;
[super dealloc];
}
@end
好吧,我坚持了一段时间,如果可能的话,有任何资源,文章内容是 NSoperation 的基本示例吗?