目前,我试图与一位网络服务器连接,并从中抽出一张桌子。 我已将表格列入一个名为“数据表”的NSMutable阵列(全球)。 然而,当我试图预示任何类型的行动时(图例:计数),它将给我一个EXC_BAD_ACCESS。 BTW I m使用ARC的X代码4.2,因此不是记忆管理问题。 任何建议?
- (void)viewDidLoad
页: 1
NSURL *url = [NSURL URLWithString: @"`url.com`"];
NSData *jsonData =[NSData dataWithContentsOfURL:url];
if(jsonData)
页: 1
xmlParser = [[NSXMLParser alloc] initWithData: jsonData];
[xmlParser setDelegate: self];
[xmlParser parse];
iii
NSLog(@"This is Number of elements: %@",[DataSet count]); ///<----EXC_BAD_ACCESS
..... //// default stuff//.....
iii
- (撤销)parser:NSXMLParser *)parser doEndElement:NSString *)elementName namespaceURI:NSString *
页: 1
if ([elementName isEqualToString:@"string"])
页: 1
/// puts the data into Array luckyNumbers
NSError *error;
SBJsonParser *json = [[SBJsonParser new] init];
DataSet = [[NSMutableArray alloc] init];
DataSet = [json objectWithString:soapResults error:&error];
/// NSLog(@"%@",DataSet); /// this works
iii
iii
I m not sure if I m suppose to but, I read that I should use Diagnostics, so I turned on NSZombie objects, Malloc guard, and Malloc Stack. They said I should type this into the gdb console info malloc-history (memorylocation)
However I don t know where to get the memory location of the problem. I would appreciate any help.
我无法做到这一点,因此,我尝试使用NSDictionary而不是NSArray,令人惊讶地工作! 这里,我更新了有关任何人的法典。
- (void)viewDidLoad
页: 1
NSURL *url = [NSURL URLWithString: @"url.com"];
NSData *jsonData =[NSData dataWithContentsOfURL:url];
DataSet = [[NSDictionary alloc] init];
if(jsonData) 页: 1
xmlParser = [[NSXMLParser alloc] initWithData: jsonData];
[xmlParser setDelegate: self];
[xmlParser setShouldResolveExternalEntities:YES];
[xmlParser parse];
iii
NSLog(@"%@",DataSet.allKeys);
///// default stuff /// iii iii
- (撤销)parser:NSXMLParser *)parser doEndElement:NSString *)elementName namespaceURI:NSString *
页: 1
if ([elementName isEqualToString:@"string"])
页: 1
//NSLog(@"%@",DataSet);
DataSet = [soapResults JSONValue];
NSLog(@"%@",DataSet);
iii
iii