http://blog.csdn.net/betterbb/article/details/25984455
FMDB存储字典或数组时会变成字符串存入sqlite里,但如果不将其转换成json格式存储,你查询获取数据时就会获取无法转换成字典或数组的字符串。
转换JSON存储:
NSArray *picArr = (NSArray *)dic[@"pic"];
NSError *err = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:picArroptions:NSJSONWritingPrettyPrinted error:&err];
NSString *jsonStr = [[NSString alloc] initWithData:jsonDataencoding:NSUTF8StringEncoding];
获取用第三方包 JSONKIT转换数组或字典
FMResultSet *set = [app.db executeQuery:@"SELECT * FROM CACHE"];
while ([set next]) {
NSString *str = [set stringForColumn:@"IMGURL"];
//第三方包jsonKit转换
NSArray *arr =(NSArray *)[str objectFromJSONString];
}