Sử dụng hình ảnh gợi ý hồ sơ, đây là cách tôi đã làm nó: Có lẽ không phải là cách tốt nhất nhưng điều này là tốt nhất tôi có thể làm gì với kiến thức C mục tiêu thực tế của tôi
__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;
}
}
}
];
với
localDateYYYYMMDD = [[NSDateFormatter alloc] init];
[localDateYYYYMMDD setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
[localDateYYYYMMDD setDateFormat:@"yyyy-MM-dd"];
Googled một chút, có vẻ không có. – apscience