我收到这个错误,上面写着只添加到内存的地址。我使用 JSON 链接来加载一些键和值。
这是代码:
NSString *str = @"http://jsonsite";
NSURL *linkJson = [[NSURL alloc]initWithString:str];
jsonData = [NSData dataWithContentsOfURL:linkJson];
if (jsonData != nil)
{
NSError *error = [[NSError alloc]init];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error];
我在这些数组中加载键和值,简单地说:
news_Number = [dict valueForKey:@"NewsID"];
news_Date = [dict valueForKey:@"NewsDate"];
news_Title = [dict valueForKey:@"Titr"];
news_Image = [dict valueForKey:@"FileName"];
news_service = [dict valueForKey:@"RootServiceName"];