NSString *userID = @"userid123";
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"确定删除?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *giveUpAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
AVQuery *query = [[AVQuery alloc] initWithClassName:@"ToDo"];
[query whereKey:@"user_id" equalTo:userID];
NSError *err;
NSArray *objects = [query findObjects:&err];
if (!err) {
[AVObject deleteAllInBackground:objects block:^(BOOL succeeded, NSError *error) {
if (!error) {
NSLog(@"delete done.");
}
else {
NSLog(@"error info: %@", error);
}
}];
}
else {
NSLog(@"error info: %@", err);
}
}];
[alertController addAction:cancelAction];
[alertController addAction:giveUpAction];
[self presentViewController:alertController animated:YES completion:nil];
上面的代码执行到NSArray *objects = [query findObjects:&error];
后就结束了,没有任何输出;
断点设置在if (!err) {
处,但程序不会执行到此处。
请问这是什么情况呢?是因为线程问题吗?
-
创建时间
17年3月16日
-
最后回复
17年3月16日
-
1
回复
-
899
浏览
-
1
用户