1

写真を Parse にアップロードしようとすると、奇妙なエラーが発生します。

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<PFQuery 0xbe68310> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key profilePic.'

なぜこれが起こっているのかわかりません。コードはこちら。

- (IBAction)setProfilePressed:(id)sender {


    PFQuery *query = [PFQuery queryWithClassName:@"Cards"];
    [query whereKey:@"name" containsString:[[PFUser currentUser] objectForKey:@"name"]];


    UIImage *image = [UIImage imageNamed:@"male_user_icon.png"];


    NSData *imageData = UIImagePNGRepresentation(image);

    PFFile *imageFile = [PFFile fileWithName:@"male_user_icon.png" data:imageData];
    [imageFile saveInBackground];


    [query setValue:imageFile forKey:@"profilePic"];


}

profilePic タイプは「ファイル」に設定されており、PFFile をアップロードしているため、何が問題なのかわかりません。さらに情報が必要な場合はお知らせください。

4

1 に答える 1