-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//获取图片的NSURL 来源于AssetsLibrary.framework #import
NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
//ALAssetsLibrary 获取图片和视频
ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];
//根据url获取指定的图片 如果获取到了资源执行resultBlock,否则执行failureBlock
//ALAsset实例 代表一个图片或者视频
[library assetForURL:url resultBlock:^(ALAsset *asset){
//defaultRepresentation 获取资源文件的默认属性
//metadata 获取数据的数据,就是在默认属性中的数据,称之为元数据
NSDictionary *imageData = [[NSMutableDictionary alloc]initWithDictionary:asset.defaultRepresentation.metadata];
//kCGImagePropertyGPSDictionary 关于GPS的字典数据 来源于ImageIO.framework #import
NSDictionary *gpsData = [imageData objectForKey:(NSString *)kCGImagePropertyGPSDictionary];
//打印纬度
NSLog(@"%@",[gpsData objectForKey:@"Altitude"]);
}failureBlock:^(NSError *error){
NSLog(@"error:%@",error);
}];
}