iPhone CoreData join

后端 未结 2 1191
礼貌的吻别
礼貌的吻别 2020-12-18 12:52

this is my core data model:

\"enter

I\'m trying to get all LanguageEntries fro

2条回答
  •  孤城傲影
    2020-12-18 13:25

    The predicate properly wasn't created correctly, you must pass the parameters to predicateWithFormat. It should have been:

    fetchRequest.predicate = [NSPredicate predicateWithFormat:@"Category.categoryName = %@ AND LanguageSet.languageSetName = %@", 
                                                              @"Food", 
                                                              @"English####Spanish"];
    

    In case you were wondering what that does is it puts quotes around the string parameters automatically which are required when using a string in a predicate. When you created the query using NSString's format method that did not put the required quotes in.

提交回复
热议问题