Utilizzando l'immagine del profilo suggerimento, questo è come ho fatto: Forse non è il modo migliore, ma questo è il meglio che posso fare con il mio attuale conoscenza oggettiva C
__block NSDate *oldestPictureDate = [NSDate date];
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"albums.fields(name,photos.fields(created_time))"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSArray* albums = result[@"albums"][@"data"];
NSUInteger index = [albums indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
return [obj[@"name"] isEqualToString: @"Profile Pictures"];}];
if (index != NSNotFound) {
NSDictionary *profileImages = albums[index];
NSDictionary *photos = profileImages[@"photos"];
NSArray *data = photos[@"data"];
for (NSDictionary *picture in data) {
NSDate* pictureCreationDate = [localDateYYYYMMDD dateFromString:[picture[@"created_time"] substringToIndex:10]];
if([oldestPictureDate compare:pictureCreationDate] > 0) oldestPictureDate = pictureCreationDate;
}
}
}
];
con
localDateYYYYMMDD = [[NSDateFormatter alloc] init];
[localDateYYYYMMDD setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
[localDateYYYYMMDD setDateFormat:@"yyyy-MM-dd"];
Googled per un po ', sembra no. – apscience