0
我有一個簡單的UIViewControler,當我調用方法[self performSelectorInBackground:@selector(load)withObject:nil];它會導致和EXC_BAD_ACCESS@autoreleasepool EXC_BAD_ACCESS
這裏是UIViewControler.m和UIViewControler.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) UITextView *myTextView;
@end
#import "ViewController.h"
@implementation ViewController
@synthesize myTextView;
- (id)init {
self = [super init];
if (self) {
myTextView = [[UITextView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[[self view] addSubview:myTextView];
[self performSelectorInBackground:@selector(load) withObject:nil];
}
return self;
}
- (void) load {
@autoreleasepool {
[myTextView setText:@"LOADING ..."];
//DO SOMETHING ....
}
}
@end
PS:
該項目採用Objective-C的ARC
什麼是崩潰的堆棧跟蹤? – kperryua