4

我正在努力寻找一些有用的东西来自动将照片从照片库上传到我的服务器端。在我的 iphone 应用程序中,我想在用户拍摄新照片时自动将照片上传到服务器。facebook、Dropbox 和 google plus 应用程序的做法。

任何帮助。

4

1 回答 1

0

大多数情况下,这是一个3 步过程:

1)获取照片。将其存储到Documents Directory中。苹果在这里很好地描述了它: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上传到服务器文件夹

于 2013-03-28T13:28:34.750 回答