Crashes with “crashes here with EXC_BAD_ACCESS” when trying to setText within the thread.
???
thx
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UITextViewDelegate>
{
UITextView *tvCommand;
}
@end
---------
-(void) Thread_Tcp
{
[tvCommand setText:@"HELLO"];//crashes here with EXC_BAD_ACCESS
}
- (void)viewDidLoad
{
NSThread *hThread = [NSThread alloc] initWithTarget:self selector:@selector(Thread_Tcp) object:nil];
[hThread start];
}
Changes to the UI should be done from the UI thread only. This concept is similar in most of the UI programming environments / frameworks.
You can fix it by calling: