Yes it is possible.
You must use ALAssetsLibrary
to access your camera roll. Then you simply list your photos and request a location.
assetsLibrary = [[ALAssetsLibrary alloc] init]; groups = [NSMutableArray array]; [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if (group == nil) { return; } [groups addObject:group]; } failureBlock:^(NSError *error) {
This will list your asset groups. Then you select a group and list its assets.
ALAssetGroup *group = [groups objectAtIndex:0]; [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { if (result == nil) { return; }
Your loc
variable now contains the location of the place where the photo was taken. Before use, you should check it for ALErrorInvalidProperty
, as some photos may not have this data.
You can specify ALAssetPropertyDate
to get the date and time the photo was taken.
source share