//array转data
NSArray *arr1 = [[NSArray alloc]initWithObjects:@"0",@"5",nil];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr1];
//data转array
NSArray *arr2 = [NSKeyedUnarchiver unarchiveObjectWithData:data];
//array转data
NSArray *arr1 = [[NSArray alloc]initWithObjects:@"0",@"5",nil];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr1];
//data转array
NSArray *arr2 = [NSKeyedUnarchiver unarchiveObjectWithData:data];
本文标题:iOS NSArray与NSData互相转化
本文链接:https://www.haomeiwen.com/subject/ulpsoqtx.html
网友评论