私は、メソッドwriteImageToSavedPhotosAlbumを使用します。メタデータ:completionBlockは:写真をアルバムに撮影した画像を保存し、コードは次のとおりです。writeImageToSavedPhotosAlbum:メタデータ:completionBlock:
-(void)savePhotoToAlbum{
CGImageRef imageRef=[imageView image].CGImage;
NSDictionary *currentDic=[self getLocation];
NSDictionary *metadata=[NSDictionary dictionaryWithDictionary:currentDic];
ALAssetsLibrary *library=[[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:imageRef metadata:metadata completionBlock:^(NSURL *assetURL,NSError *error){
if(error == nil)
{
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:nil message:@"Save success!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
else
{
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:nil message:@"Save failure!" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
}];
[library release];
ユーザの現在位置を取得している
} 【選択方式のgetLocationこと!成功を救うことができます!その後、私は写真アルバムの使用UIImagePickerControllerから撮影した写真を選びたいと思います!コード:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{ if([picker sourceType]==UIImagePickerControllerSourceTypeSavedPhotosAlbum)//picker image delegate
{
NSString *mediaType=[info objectForKey:UIImagePickerControllerMediaType];
if([mediaType isEqualToString:@"public.image"])
{
NSDictionary *metadata=[info objectForKey:UIImagePickerControllerMediaMetadata];
NSLog(@"%@",metadata);
}
}
}
ログはメタデータがnullです。その理由は何ですか?そして私が保存したメタデータ情報を入手するにはどうすればいいですか?ありがとう!
は私がたsourceTypeとして利用可能な画像のメタデータをされて知っている、あなたに真実を伝えるUIImagePickerControllerSourceTypeCamera.But私は、メタデータ情報を取得する方法がわかりません?どちらの方法を使うことができますか? – scofield