iOS NSArray与NSData互相转化

//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互相转化)