我在我的應用程序中使用了xml解析器。當我運行10到15次的應用程序時,它的工作正常,但突然它給了我上面代碼的bad_access。我的XML解析器代碼如下:xmlParser中的exc_bad_access(code = 2,address = 0x20)
-(BOOL)getTheServerStatus:(NSData *)webData
{
if (webData==NULL)
{
return FALSE;
}
parser=[[NSXMLParser alloc]initWithData:webData];
[parser setDelegate:self];
[self performSelectorOnMainThread:@selector(parseData:)
withObject:webData
waitUntilDone:YES];
if([strVal isEqualToString:@"ok"])
{
return TRUE;
}
else
{
return FALSE;
}
}
- (void)parseData:(NSData *)webData
{
if(webData==NULL)
{
NSLog(@"web data is NULL");
}
[parser parse];
}
我正在使用自動引用計數。那麼我的代碼有什麼問題?
嘗試啓用NSZombie爲您的應用程序..可能是它可以幫助 – 2012-08-17 10:39:41
如何啓用 – 2012-08-17 10:53:36
產品 - >編輯方案 - >診斷 - >(選擇)啓用殭屍對象 – 2012-08-17 10:54:56