我在viewcontroller中有一个UIWebView,它有两个方法如下.问题是如果我在第二个线程完成之前弹出(点击导航栏)此控制器,应用程序将在[super dealloc]之后崩溃,因为"试图从主线程以外的线程获取Web锁定或这可能是从辅助线程调用UIKit的结果." 任何帮助将非常感激.
-(void)viewDidAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(load) object:nil];
[operationQueue addOperation:operation];
[operation release];
}
-(void)load {
[NSThread sleepForTimeInterval:5];
[self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO];
}
Run Code Online (Sandbox Code Playgroud) 如果a与c相同,b与c相同,为什么a与b不相同?
var a = [1, 2, 3]
var b = a
var c = a[0...2]
a === c // true
b === c // true
a === b // false
Run Code Online (Sandbox Code Playgroud)
如果a,b,c是常数:
let a = [1, 2, 3]
let b = a
let c = a[0...2]
a === c // true
b === c // true
a === b // true
Run Code Online (Sandbox Code Playgroud)