当我运行时,PfQuery orQueryWithSubqueries崩溃应用程序

时间:2013-11-27 18:00:41

标签: ios tableview parse-platform pfquery

大家好我正在使用,我正在使用parse.com PFQuery orQuerywithSubqueries

到目前为止一切都运行良好,现在我需要添加第四个查询,但是当我开始运行时,应用程序会一直崩溃...有谁知道为什么会这样?

- (void)  QueryForPost {
    
    PFUser CurrentGoUser * = [ PFUser currentUser ] ;
    
    PFQuery QueryForFriend * = [ PFQuery queryWithClassName : FF_AMICIZIE_CLASS ] ;
    [ QueryForFriend whereKey : FF_AMICIZIE_A_USER equalTo : CurrentGoUser ] ;
    [ QueryForFriend whereKey : FF_AMICIZIE_STATO equalTo : @ " Confirmed "];
    [ QueryForFriend includeKey : FF_AMICIZIE_DA_USER ] ;
        
    PFQuery QueryForPost * = [ PFQuery queryWithClassName : FF_POST_CLASS ] ;
    [ QueryForPost whereKey : FF_POST_FLASH_POST_BOOLEANVALUE equalTo : [ NSNumber numberWithBool : YES] ] ;
    [ QueryForPost whereKey : FF_POST_SCELTI equalTo : CurrentGoUser ] ;

    PFQuery normalPostByFriends * = [ PFQuery queryWithClassName : FF_POST_CLASS ] ;
    [ normalPostByFriends whereKey : FF_POST_FLASH_POST_BOOLEANVALUE equalTo : [ NSNumber numberWithBool : NO ]] ;
    [ normalPostByFriends whereKey : FF_POST_UTENTE matchesKey : FF_AMICIZIE_DA_USER inquery : QueryForFriend ] ;
    
    PFQuery normalPostByUser * = [ PFQuery queryWithClassName : FF_POST_CLASS ] ;
    [ normalPostByUser whereKey : FF_POST_FLASH_POST_BOOLEANVALUE equalTo : [ NSNumber numberWithBool : NO ]] ;
    [ normalPostByUser whereKey : FF_POST_UTENTE equalTo : CurrentGoUser ] ;
    
    PFQuery queryForGoPointStatus * = [ PFQuery queryWithClassName : @ " goPoint "];
    [ queryForGoPointStatus whereKey : @ " AssegnatoDa " equalTo : CurrentGoUser ] ;


    PFQuery * query = [ PFQuery orQueryWithSubqueries : @ [ QueryForPost , normalPostByFriends , normalPostByUser , queryForGoPointStatus ]] ;
    [ query includeKey : FF_POST_UTENTE ] ;
    [ includeKey query : @ " AssegnatoDa "];
    [ query OrderByDescending : FF_CREATEDAT ] ;
  
    [ query findObjectsInBackgroundWithBlock : ^ ( NSArray * results, NSError * error ) {
       
        if (! error) {
            ArrayforPost = [ [ NSMutableArray alloc] init ] ;
            for ( PFObject * object in results ) {
                [ ArrayforPost addObject : object ] ;
            }
            [ self.FFTableView reloadData ] ;
        Else { }
            NSLog ( @ " Erroreeeee :% @" , error) ;
        }
    } ] ;
   
}

1 个答案:

答案 0 :(得分:1)

异常消息说明了所有内容:All sub queries of an or query should be on the same class。因此,您只能在FF_POST_CLASSFF_AMICIZIE_CLASS上使用谓词,但不能同时使用两者。由于它是OR谓词,您只需发出2个请求并合并结果。