0

i am newbie in Parse.in my Parse Table One Table Contain Location column and its type is object like as it is Shown in to Image.

enter image description here

Here i save An Array Value in to this Column like as

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];

Then it Give me Error like as invalid type for key Location, expected map, but got array (Code: 111, Version: 1.6.2).

Please Give me Solution for it.

1 Answer 1

1

Why do you use object type? You should use GeoPoint.

if you wont to set NSArray than parse Datatype is Array not Object

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
Sign up to request clarification or add additional context in comments.

2 Comments

But here my Column Type Object is Predefined and i have not edit to this.
you can try gameScore[@"Location"]=firstJsonDictionary;, it may be work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.