本地读取Json失败

直接向读取数组一样的        _AllARY = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Address" ofType:@"plist"]];

失败,则可以

       
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"city" ofType:@"json"];
        NSLog(@"filePath: %@", filePath);
        
        NSData *jsonData = [NSData dataWithContentsOfFile:filePath];
        NSLog(@"jsonData: %@", jsonData);
        
        NSError *error = nil;
        NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments|NSJSONReadingMutableLeaves error:&error];
        NSLog(@"jsonDict: %@", jsonDict);
        NSLog(@"error: %@", error);

你可能感兴趣的:(本地读取Json失败)