내가 방법 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