Last active
August 29, 2015 14:22
-
-
Save nderkach/cdcb7e0f555ccc9485ec to your computer and use it in GitHub Desktop.
https://developers.facebook.com/bugs/757618101026257 PFQueryTableViewController workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)objectsDidLoad:(nullable NSError *)error { | |
[super objectsDidLoad:error]; | |
__block PFGeoPoint *currentLocation = [PFUser currentUser][@"location"]; | |
NSSortDescriptor *distanceDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES comparator:^NSComparisonResult(PFGeoPoint* obj1, PFGeoPoint* obj2) { | |
return [@([currentLocation distanceInMilesTo:obj1]) compare:@([currentLocation distanceInMilesTo:obj2])]; | |
}]; | |
[self setValue:[[self.objects sortedArrayUsingDescriptors:@[distanceDescriptor]] mutableCopy] forKey:@"_mutableObjects"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment