NSThread를 사용할 때 콘솔에 다음과 같은 오류 메시지가 표시됩니다. "주 스레드 나 웹 스레드가 아닌 다른 스레드에서 웹 잠금을 얻으려고했습니다.이 오류는 보조 스레드에서 UIKit을 호출 한 결과 일 수 있습니다. .. "스레드를 사용할 때 오류를 해결하는 방법은 무엇입니까?
여기 내 샘플 코드 여기
- (void)viewDidLoad {
appDeleg = (NewAshley_MedisonAppDelegate *)[[UIApplication sharedApplication] delegate];
[[self tblView1] setRowHeight:80.0];
[super viewDidLoad];
self.title = @"Under Ground";
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[NSThread detachNewThreadSelector:@selector(CallParser) toTarget:self withObject:nil];
}
-(void)CallParser {
Parsing *parsing = [[Parsing alloc] init];
[parsing DownloadAndParseUnderground];
[parsing release];
[self Update_View];
//[myIndicator stopAnimating];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
제출해야"DownloadAndParseUnderground "는 RSS 피드에서 데이터를 downloding의 방법
-(void) Update_View{
[self.tblView1 reloadData];
}
어이다 EN Update_View 방법은있는 tableView 당신이 방법을 구문 분석 스레드를 필요로하는 이유 적절한 설명 데이터를 다시로드하고 cellForRowAtIndexPath에서 오류를 생성하고 정의 셀
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
CustomTableviewCell *cell = (CustomTableviewCell *) [tblView1 dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"customCell"
owner:self
options:nil];
cell = objCustCell;
objCustCell = nil;
}
비동기 로딩에 "PerformSelectorOnMainThread"에 코드 (아래 주석) 2.Change 한 PARAM
와의 ViewController을로드하는 방법을 추가, 왜? – BoltClock
답변을 읽는 것은 두 가지 모두가 잘못 되었기 때문입니다 (또는 파싱 할 수없는 것 - 무엇이 '그 모든 것 위에 올랐습니까 ??!?). – bbum