如何通过方法获取createdAt,updatedAt的值?
PFObject gameScore = [PFObject objectWithClassName:@"GameScore"];
NSString playerName = gameScore[@"playerName"];而不是这样做:
NSDate updatedAt = gameScore.updatedAt;
NSDate createdAt = gameScore.createdAt;像我在playerName中做的那样:
NSDate *updatedAt = gameScore[@"updatedAt"];发布于 2014-04-03 13:09:58
updateAt是PFObject的属性。假设object是PFObject的一个实例。只需执行以下操作:
NSDate *updated = [object updatedAt];有关更多信息,请访问See here。
希望这能帮上忙..:)
发布于 2014-04-04 06:40:04
但是在这种情况下我没有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];
}
} https://stackoverflow.com/questions/22827946
复制相似问题