先谢谢
当我试图通过“exc_bad_access”调用webservice时出错。我把我的代码放在下面。
这是我收到错误的一小部分:
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"DONE. Received Bytes: %d", [webData length]);
NSString *theXML = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
NSLog(@"%@",theXML);
[theXML release];
if( xmlParser )
{
[xmlParser release];
}
xmlParser = [[NSXMLParser alloc] initWithData: webData]; <--- Error here.
[xmlParser setDelegate:self];
[xmlParser setShouldResolveExternalEntities: YES];
[xmlParser parse];
[activityIndicator stopAnimating];
[connection release];
[webData release];
}
答案 0 :(得分:0)
尝试添加:
xmlParser = nil;
在
之后[xmlParser release];