我正在使用IOS應用程序,在該應用程序中我從iPhone模擬器中選擇照片,並且想要將這些照片上傳到DropBox,但我無法做到這一點。我在上傳方法中沒有得到正確的參數。如何從iOS應用程序在DropBox上上傳圖片
這是我的代碼從我的控制器發送選定的圖片。此代碼將發送這是我從我的模擬器選擇了對中,我寫的代碼上傳圖片到保管箱控制器的圖像:
// UIImage *image;
// NSMutableArray *images
// @property (nonatomic, copy) NSArray *chosenImages;
for (NSDictionary *dict in info)
{
image = [dict objectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];
imageview = [[UIImageView alloc] initWithImage:image];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
imageview.frame = workingFrame;
self.chosenImages = images;
RootViewController *rvc=[[RootViewController alloc]init];
[rvc _startUpload:image];
[self.navigationController pushViewController:rvc animated:YES];
}
現在在我的RootViewController的我寫的代碼在這種方法上傳圖片:_startUpload:圖像法用於上傳圖片
-(void)_startUpload:image
{
NSString *fileName = @"myImage.png";
NSString *tempDir = NSTemporaryDirectory();
NSString *imagePath = [tempDir stringByAppendingPathComponent:fileName];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(self.loadQRCodeImage.image)];
[imageData writeToFile:imagePath atomically:YES];
[self.restClient uploadFile:fileName toPath:dropBoxFolder fromPath:imagePath];
}
我沒有收到我的Dropbox的中圖片,請幫助我,我在做什麼錯了,這路我真正用於上傳圖片。請幫幫我。
在此先感謝。
什麼是dropBoxFolder? –
https://www.dropbox.com/developers/sync/start/ios –