私のアプリでは、写真を撮り、それを画像ビューで表示しています。
サーバーにアップロードできるように、その画像のパスが必要です。
どうすればそのパスを取得できますか?ALAssetフレームワークをインポートしようとしましたが、xコード(4.2)iOS5.0と呼ばれるフレームワークがありません
NSData *data = UIImagePNGRepresentation(imagePic.image);
NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:@"upload.jpg"];
[data writeToFile:file atomically:YES];
[[EPUploader alloc] initWithURL:[NSURL URLWithString:@"myWebSite"]
filePath:@"file"
delegate:self
doneSelector:@selector(onUploadDone:)
errorSelector:@selector(onUploadError:)];
これは私が現在試していることです。
また、iPhoneのカメラロールの写真へのハードコードされたパスは何でしょうか?「iphone/pictures /myPic」?? パスを見つけるのとは別にアップロードを試すことができます。
どうぞよろしくお願いします
編集:
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
image2 = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
// Save image
UIImageWriteToSavedPhotosAlbum(image2, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
imagePic.image = image2;
[picker release];
}