gpt4 book ai didi

ios - parse.com key 类型无效,需要映射,但得到数组

转载 作者:行者123 更新时间:2023-11-29 02:20:10 24 4
gpt4 key购买 nike

我是 Parse 的新手。在我的解析表中,一个表包含 Location 列,其类型为 object,如图像中所示。

enter image description here

这里我将数组值保存到此列中,如下所示

NSDictionary *firstJsonDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
@"10.010490", @"latitude",
@"76.360779", @"longitude",
nil];
NSMutableArray * arr = [[NSMutableArray alloc] init];
[arr addObject:firstJsonDictionary];
PFObject *gameScore = [PFObject objectWithClassName:@"MapInfo"];
gameScore[@"Location"]=arr;
[gameScore saveInBackground];

然后它像这样给我错误关键位置的类型无效,需要 map ,但得到数组(代码:111,版本:1.6.2)

请给我解决方案。

最佳答案

为什么使用对象类型?您应该使用 GeoPoint。

如果你不想设置 NSArray 而不是解析数据类型是数组而不是对象

image

//Set Value
PFObject * objLocationClass=[PFObject objectWithClassName:@"Class_Location"];

PFGeoPoint * geoPoint=[PFGeoPoint geoPointWithLatitude:latitude longitude:longitude];
[objLocation setObject:geoPoint forKey:@"location"];
//Get Value
PFGeoPoint *userGeoPoint = (PFGeoPoint *)[objLocation valueForKey:@"location"];
//userGeoPoint.latitude or userGeoPoint.longitude

关于ios - parse.com key 类型无效,需要映射,但得到数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28249108/

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