Xcode NsPredicate
Hello can someone help me with NSPredicate??
I'm trying to filter an array of objects like this:
{
"id": "0",
"title": "Crucifix and sarcophagus of Ariberto da Intimiano",
"categoryName": "COMMEMORATIVE MONUMENTS",
"audioFile": "Crucifix-and-sarcophagus-of-Ariberto-da-Intimiano",
"videoFile": null,
"textFile": "Crucifix-and-sarcophagus-of-Ariberto-da-Intimiano",
"image":
"content/0/Crucifix-and-sarcophagus-of-Ariberto-da-Intimiano_flow.jpg",
"numPictures": "1",
"didascalie": ["dida 1", "dida 2", "dida 3"],
"description": "Crucifix and sarcophagus of Ariberto da Intimiano",
"link": ""
},
{
"id": "1",
"title": "The sundial of Duomo",
"categoryName": "THE SUNDIAL",
"audioFile": "The-sundial-of-Duomo",
"videoFile": null,
"textFile": "The-sundial-of-Duomo",
"image": "content/1/The-sundial-of-Duomo_flow.jpg",
"numPictures": "2",
"didascalie": ["dida 1", "dida 2", "dida 3"],
"description": "The sundial of Duomo",
"link": ""
}
NSPredicate *key1Predicate = [NSPredicate predicateWithFormat:@"title ==
'%@'",_searchAZ.text];
_ArtWorksTableResults = [[_ArtWorksTable
filteredArrayUsingPredicate:key1Predicate] mutableCopy];
NSLog(@"%i",_ArtWorksTableResults.count);
When i perform the search the _ArtWorksTableResults.count is always 0.
But if i write the predicate instead of using the search bar text like this:
NSPredicate *key1Predicate = [NSPredicate predicateWithFormat:@"title ==
'The sundial of duomo'"];
_ArtWorksTableResults = [[_ArtWorksTable
filteredArrayUsingPredicate:key1Predicate] mutableCopy];
NSLog(@"%i",_ArtWorksTableResults.count);
The _ArtWorksTableResults.count is 1, that is correct!
What i did wrong?
I try also to log the search bar text and everything is ok.
I can't understand why if i write the key of search directly in the code
works!
Please help me!
The world of attorneys can seem overwhelming to people who are unfamiliar with it. You can learn what you have a reliable lawyer for your needs. Keep reading to learn more about what to expect from a good lawyer.
ReplyDeletedontgotoschoolnaked |
gatewaycanyonairtour |
greeneducationcuhk |
halosystech |
heavyhaulsoftware |