在iPhone应用程序中自动上传相机胶卷? [英] Auto upload camera roll in iPhone Application?
问题描述
我很难找到一些有用的功能,可以自动将照片从照片库上传到我的服务器端。
在我的iphone应用程序中,我想在用户拍摄新照片时自动将照片上传到服务器。
facebook,Dropbox和google plus app的方式。
I am struggling to find something useful for automatically uploading photos from photo library to my server end. In my iphone application i wan to automatically upload the photos to server as user captures a new photo. The way facebook, Dropbox and google plus app doing.
任何帮助。
推荐答案
主要是 3步骤:
1)获取照片。将其存储到文档目录。 Apple在这里描述得非常好: PhotoPicker
1) Get the photo. Store it to the Documents Directory. Apple has described it very well here : PhotoPicker
2)从文档目录中获取照片:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"Images"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[dataPath stringByAppendingPathComponent:[NSString stringWithFormat:@"yourImage.png"]]];
3)现在,您可以将照片上传到服务器。这个过程很好地描述了这里:
将图片从iphone上传到服务器文件夹
3) Now , you can upload your Photo to the Server. The Process is well described Here : upload image from iphone to the server folder
这篇关于在iPhone应用程序中自动上传相机胶卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!