Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在线程中调用NSPathControl对象时崩溃_Objective C_Crash_Multithreading - Fatal编程技术网

Objective c 在线程中调用NSPathControl对象时崩溃

Objective c 在线程中调用NSPathControl对象时崩溃,objective-c,crash,multithreading,Objective C,Crash,Multithreading,出于某种原因,在线程中调用NSPathControl对象会导致崩溃 - (IBAction) action5:(id)sender { [outlet_NSPathControl1 setURL: [NSURL fileURLWithPath: @"/Users/admin/"]]; // Works fine here [self performSelectorInBackground:@selector(background1) withObject:self]; // Jump to

出于某种原因,在线程中调用NSPathControl对象会导致崩溃

- (IBAction) action5:(id)sender {
 [outlet_NSPathControl1 setURL: [NSURL fileURLWithPath: @"/Users/admin/"]]; // Works fine here
 [self performSelectorInBackground:@selector(background1) withObject:self]; // Jump to the thread
}

-(void) background1 {
 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 [outlet_NSButton1 setTitle: [NSString stringWithFormat: @"%d", index]];
 [outlet_NSPathControl1 setURL:[NSURL fileURLWithPath: @"/Users/admin/"]]; // Crashes here
 [pool drain];
}
“Crash”的描述还不足以提供任何特定的帮助,但是如果一个类没有被列为线程安全的,那么它可能就不是


UI元素通常也只能从主线程更新

谢谢你提供的信息。正如你可能知道的那样,我是Mac编程新手。