>拍摄影像
>将对象添加到数组
>将数组转换为NSData
>将NSData转换为PFfile
>设置文件上传目的地(通过唯一的objectID)
>将PFfile上传到Parse
这就是代码的样子;请原谅,它现在在dismissVIEwController中,我只是想让它成功保存:
- (voID) imagePickerController:(UIImagePickerController *)picker dIDFinishPickingMediawithInfo:(NSDictionary *)info{_takenImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalimage];[self dismissVIEwControllerAnimated:YES completion:^{ // Add object to array: Working [_tankImagesArray addobject:_takenImage]; NSLog(@"Number of images taken: %lu",(unsigned long)_tankImagesArray.count); // Convert array to NSData Object NSData *imageData = [NSKeyedArchiver archivedDataWithRootObject:_tankImagesArray]; // Convert NSData Object to PFfile PFfile *imagefile = [PFfile fileWithData:imageData]; PFquery *tankquery = [PFquery queryWithClassname:@"SavedTanks"]; _tankObject = [tankquery getobjectWithID:_passedValue]; [_tankObject setobject:imagefile forKey:@"tankImages"]; [_tankObject save];}];}
现在,我的问题是:我究竟如何检索该文件?我的最终目标是允许用户查看他们过去拍摄的图像并添加到集合中的图片列表并将其上传到服务器.我只是不确定如何在上传文件后检索文件,并确保保持完整性.
解决方法 你试过了吗:PFquery *query = [PFquery queryWithClassname:@"SavedTanks"];[query whereKey:@"tankImages" equalTo:@"your_image.jpg"];[query findobjectsInBackgrounDWithBlock:^(NSArray *objects,NSError *error) { if (!error) { // The find succeeded. NSLog(@"Successfully retrIEved %d images.",objects.count); // Do something with the found objects for (PFObject *object in objects) { NSLog(@"%@",object.objectID); } } else { // Log details of the failure NSLog(@"Error: %@ %@",error,[error userInfo]); }}];总结
以上是内存溢出为你收集整理的从Parse iOS下载图像全部内容,希望文章能够帮你解决从Parse iOS下载图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)