感谢@stee的帮助,我能够将图片上传到parse.com中的正确课程。现在我无法在用于上传的相同uiimageview中显示相同的图像。从Picker上解析图片上传
在@stee和@Joey的帮助下,我能够将下面的代码添加到我的viewdidload中。现在,我收到一条警告,提示*图像未使用的变量,当我编译并运行时,我可以上传,但只要我离开控制器,图像就不会在那里。
- (void)viewDidLoad {
[super viewDidLoad];
PFFile * myPFFile = [[PFUser currentUser] objectForKey:@"ProfilePicture"];
[myPFFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (!error) {
UIImage *image = [UIImage imageWithData:data];
// image can now be set on a UIImageView
}
}];
}
如果它可以帮助你明白我做了什么,下面是我用来上传照片
PFObject *User = [PFUser currentUser];
NSData *imageData = UIImageJPEGRepresentation(_imageView.image, 0.8);
NSString *filename = [NSString stringWithFormat:@"%@.png", _username.text];
PFFile *imageFile = [PFFile fileWithName:filename data:imageData];
[User setObject:imageFile forKey:@"ProfilePicture"];
代码有什么,我从我的viewDidLoad中缺少什么?我是否缺少我的.h文件中的任何内容?
在我的.h文件中我有那样的uiimageview;
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
我非常感谢任何进一步的帮助,使这成为可能。
@Stee任何想法,我可能在这里做错了吗? – 2015-02-16 17:11:48