Parse - PFObject - 属性

时间:2014-04-03 04:35:41

标签: ios parsing object properties subclass

如何通过方法获取createdAt,updatedAt的值?

PFObject gameScore = [PFObject objectWithClassName:@"GameScore"]; 
NSString playerName = gameScore[@"playerName"];

而不是这样做:

NSDate updatedAt = gameScore.updatedAt; 
NSDate createdAt = gameScore.createdAt;

就像我在playerName中所做的那样:

NSDate *updatedAt = gameScore[@"updatedAt"];

2 个答案:

答案 0 :(得分:0)

updateAtPFObject的属性。让objectPFObject的实例。就这样做:

NSDate *updated = [object updatedAt];

See here了解更多信息。

希望这会有所帮助.. :)

答案 1 :(得分:0)

但在这种情况下我没有PFObject! 我正在进行查询以获取我的类'boteco'的值,并且我将带有信息的pin添加到我的mapView

PFQuery *query = [PFQuery queryWithClassName:@"boteco"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
    {
        if (!error)
        {
            mapArray = [objects copy];
            for (int i=0; i<objects.count; i++)
            {
                latitude = [[[mapArray objectAtIndex:i] valueForKey:@"latitude"] floatValue];
                longitude = [[[mapArray objectAtIndex:i] valueForKey:@"longitude"] floatValue];
                nome = [[mapArray objectAtIndex:i] valueForKey:@"nome"];
                // I want here to take the value of "updatedAt" ex: uptadedAt=[[[mapArray objectAtIndex:i] valueForKey:@"updatedAt"];
                CLLocationCoordinate2D coord = { latitude, longitude };
                DisplayMap *ann = [[DisplayMap alloc] init];
                ann.coordinate = coord;
                [mapview addAnnotation:ann];
            }
        }