2017-07-07 5 views
1

誰かが、特定のentryid値のビデオを検索するために領域クエリを構築するのを手伝ってもらえますか?RealmオブジェクトのNSPredicateクエリ

ありがとうございました!無駄に

NSPredicate *pred = [NSPredicate predicateWithFormat:@"video_kaltura['entryid'] CONTAINS[c] '0_abababa3'"]; 
RLMResults *test = [Video objectsWithPredicate:pred]; 

とそのバリエーション:

Video { 
    nid = 1; 
    video_title = OK; 
    video_description = Description { 
     value = Description; 
    }; 

    video_kaltura = Kaltura { 
     entryid = 0_abababa3; 
     mediatype = 1; 
    }; 
} 

Video { 
    nid = 2; 
    video_title = OK; 
    video_description = Description { 
     value = Description; 
    }; 
    video_kaltura = Kaltura { 
     entryid = 0_cdcdcdc3; 
     mediatype = 1; 
    }; 
} 

私のようなものを試してみました。

答えて

0

NSPredicateは、プロパティをトラバースするキーパスを使用します(object.someProperty.otherProperty)。

サンプルデータに基づいて、video_kalutra.entryid == '0_abababa3'のような述語が必要です。

+0

ありがとうございます!それはうまくいった。私は配列でも動作するようにそれを拡張しました。 NSPredicate * pred = [NSPredicate predicateWithFormat:@ "video_kaltura.entryid IN%@"、entryids]; – TrekOnTV2017

関連する問題