NSString *str = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"response"ofType:@"txt"] encoding:NSUTF8StringEncoding error:&error];
NSDictionary *dict = [self dictionaryWithJsonString:str];
FNUserCenterResponseModel *response = [FNUserCenterResponseModel yy_modelWithJSON:dict];
- (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString
{
if (jsonString == nil) {
return nil;
}
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingMutableContainers error:&err];
if(err)
{
NSLog(@"json解析失败:%@",err);
return nil;
}
// return dic;
//}
网友评论