gpt4 book ai didi

ios - 将NSArray转换为NSData iOS Objective-C

转载 作者:行者123 更新时间:2023-12-01 19:58:27 25 4
gpt4 key购买 nike

这是我的代码,但我无法获取数据

NSData *wrtData = [NSKeyedArchiver archivedDataWithRootObject:my_Array];

最佳答案

使用此示例:

   NSArray *mapPoints = @[
@{ @"latitude":@"10.010490",
@"longitude":@"76.360779",
@"altitude":@"30.833334",
@"timestamp":@"11:17:23",
@"speed":@"0.00",
@"distance":@"0.00"
},
@{
@"latitude":@"10.010688",
@"longitude":@"76.361378",
@"altitude":@"28.546305",
@"timestamp":@"11:19:26",
@"speed":@"1.614",
@"distance":@"198.525711"
}
];

NSLog(@"Countries array = %@",mapPoints);
NSData *mapPointsData = [NSKeyedArchiver archivedDataWithRootObject:mapPoints];
NSLog(@"countries data=%@",mapPointsData);
NSLog(@"mapPointsData to mapPointsArray = %@",[NSKeyedUnarchiver unarchiveObjectWithData:mapPointsData]);

Github链接:

https://github.com/k-sathireddy/JsonArrayToNSData

关于ios - 将NSArray转换为NSData iOS Objective-C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41120415/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com