Open yuukiMatsubara opened 8 years ago
質問の内容に近い「removeObject:d」がありましたので、実装してみたところ、以下で落ちてしまいます。
NCMBQuery *query = [NCMBQuery queryWithClassName:@"iine"]; [query whereKey:@"AObjectId" equalTo::@"aaaaaaaaaa"]; [query whereKey:@"BObjectId" equalTo:@"aaaaaaaaaa"]];
NSError *e = nil;
NSArray *res = [query findObjects:&e];
if (e != nil){
} else {
NCMBObject *post = [NCMBObject objectWithClassName:@"iine"];
NSString *d = [res[0] objectForKey:@"objectId"];
[post removeObject:d forKey:@"objectId"]; ← ここで落ちる
[post save:nil];
}
以下、エラー内容になります。 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Does not have a value.' *\ First throw call stack: (0x183f8c2d8 0x195c580e4 0x183f8bf5c 0x100114510 0x100113cc4 0x10008ff30 0x100090a58 0x188a39398 0x188a22474 0x188a38d34 0x1889f7f54 0x188a3282c 0x188a31ee4 0x188a05120 0x188ca62b8 0x188a03634 0x183f44240 0x183f434e4 0x183f41594 0x183e6d2d4 0x18d8c36fc 0x188a6af40 0x1000bcd18 0x196302a08) libc++abi.dylib: terminating with uncaught exception of type NSException
「removeObject」の使い方がなにか間違っていますでしょうか?
どうぞ、よろしくお願いします。
res[0] を [res[0] deleteInBackgroundWithBlock:nil]; するだけでも良いように見えるのですが、それだと駄目でしょうか?
お返信が遅くなりました。 [res[0] deleteInBackgroundWithBlock:nil];で問題なくできました。 いつも、ありがとうございました。
レコードの削除についてご質問です。 mbaasのクラスから、idが〜 で且つ年齢が 〜に 一致するレコード(条件が二つある)を削除したいのですが、どのようにすれば良いでしょうか? よろしくお願いします。