gpt4 book ai didi

ios - Parse.com 阻止无法对类型 : (null) 进行比较查询

转载 作者:行者123 更新时间:2023-11-29 02:04:25 26 4
gpt4 key购买 nike

我想阻止消息“无法对类型进行比较查询:(null)”我不想解决它,因为我知道出了什么问题,但我想放异常。如果查询没有找到任何东西...... NSLog 的东西。 (而不是崩溃)

这是我的代码:

PFQuery *requestsToCurrentUser = [PFQuery queryWithClassName:@"FriendRequest"];
[requestsToCurrentUser whereKey:@"to" equalTo:self.currentUser];
[requestsToCurrentUser whereKey:@"status" equalTo:@"pending"];
[requestsToCurrentUser findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

if (!error) {
//this property stores the data for the tableView
self.friendRequests = objects;
//reload the table
[self.tableView reloadData];

} else {

//error occcurred

}
}];

最佳答案

试着放这个

if(!self.currentUser){
// No value in self.currentUser
return;
}
PFQuery *requestsToCurrentUser = [PFQuery queryWithClassName:@"FriendRequest"];
[requestsToCurrentUser whereKey:@"to" equalTo:self.currentUser];
[requestsToCurrentUser whereKey:@"status" equalTo:@"pending"];
[requestsToCurrentUser findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

if (!error) {
//this property stores the data for the tableView
self.friendRequests = objects;
//reload the table
[self.tableView reloadData];

} else {

//error occcurred

}
}];

关于ios - Parse.com 阻止无法对类型 : (null) 进行比较查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29951153/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com