Objective c @自动释放池执行错误访问

Objective c @自动释放池执行错误访问,objective-c,cocoa-touch,exc-bad-access,autorelease,Objective C,Cocoa Touch,Exc Bad Access,Autorelease,我有一个简单的UIViewControler,当我调用方法[self-performSelectorInBackground:@selector(load)withObject:nil]它导致和执行坏访问 这是UIViewControler.m和UIViewControler.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (strong, nonatomic) UIT

我有一个简单的UIViewControler,当我调用方法[self-performSelectorInBackground:@selector(load)withObject:nil]它导致和执行坏访问

这是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
#导入
@界面ViewController:UIViewController
@属性(强,非原子)UITextView*myTextView;
@结束
#导入“ViewController.h”
@实现视图控制器
@综合myTextView;
-(id)init{
self=[super init];
如果(自我){
myTextView=[[UITextView alloc]initWithFrame:[[UIScreen mainScreen]边界]];
[[self view]addSubview:myTextView];
[self-performSelectorInBackground:@selector(load)with object:nil];
}
回归自我;
}
-(空)荷载{
@自动释放池{
[myTextView setText:@“正在加载…”;
//做点什么。。。。
}
}
@结束
PS.:


项目使用的Objective-C ARC

UIKit对象不是线程安全的:您只能在主线程上访问它们。行
[myTextView setText:@“加载…”无法在后台线程中安全执行


这可能是,也可能不是您得到
EXC\u BAD\u ACCESS
错误的原因,但是在没有看到
load
方法的其余部分的情况下,我无法知道还有什么可能是错误的。

崩溃的堆栈跟踪是什么?