フォトライブラリまたはカメラから取得した画像の名前を取得する際に問題が発生しました。画像の選択に成功しましたが、MFMailComposeViewControllerを使用して、選択した画像を電子メールの添付ファイルとして送信したいと思います。問題は、MFMailComposeViewControllerが画像の特定の名前を必要としたことです。次のコードを使用して画像名を取得しましたが、常に「assest.JPG」が返され、MFMailComposeViewControllerでは機能しません。
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{
[imageView setImage:image];
image_ = image;
image_ = [UIImage imageNamed:@"file.jpg"];
NSURL *imagePath = [editingInfo objectForKey:@"UIImagePickerControllerReferenceURL"];
imageName = [imagePath lastPathComponent];
NSLog(@"%@",imageName);
[self dismissModalViewControllerAnimated:YES];
if (CAMORLIB == 1) {
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}}
この問題に対処する他の方法はありますか?
ありがとう、
モハメッド