nspredicate

CloudKit compound query (query with OR)

喜夏-厌秋 提交于 2019-12-01 17:41:42
I would like to query CloudKit using OR with two fields. But I can't find a way how to do this. What I did is: NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@)", userId]; NSPredicate *predicate2 = [NSPredicate predicateWithFormat:@"(toUser == %@)", userId]; NSCompoundPredicate *compPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[predicate1, predicate2]]; CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Message" predicate:compPredicate]; But unfortunately CKQuery does not support OR query (as written in documentation) Can I achieve

CloudKit compound query (query with OR)

耗尽温柔 提交于 2019-12-01 17:36:12
问题 I would like to query CloudKit using OR with two fields. But I can't find a way how to do this. What I did is: NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@)", userId]; NSPredicate *predicate2 = [NSPredicate predicateWithFormat:@"(toUser == %@)", userId]; NSCompoundPredicate *compPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[predicate1, predicate2]]; CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Message" predicate

using NSPredicate with a set of answers

落爺英雄遲暮 提交于 2019-12-01 17:29:35
问题 I have a set of strings containing personIDs and I have a NSFetchedResults of people managedObjects with unique strPersonIDs. I tried to create an NSPredicate but it fails. Any help with this would be greatly appreciated. I'm a bit new to NSPredicate so be kind. NSSet *zipSet = [NSSet setWithSet:[self getziplist:searchText]]; searchString = [NSString stringWithFormat:@"(strPersonID IN %@)",zipSet]; NSPredicate *searchPersonPredicate = [NSPredicate predicateWithFormat:searchString]; The

NSPredicate with dynamic key and value

∥☆過路亽.° 提交于 2019-12-01 15:21:38
问题 I am trying to create a function that searches through my core data stack and return the amount of messages for a desired key/value. Here is my code: NSFetchRequest *messagesCountRequest = [NSFetchRequest fetchRequestWithEntityName:@"Message"]; NSEntityDescription *messageCountModel = [NSEntityDescription entityForName:@"Message" inManagedObjectContext:_mainManagedObjectContext]; [messagesCountRequest setEntity:messageCountModel]; NSPredicate *messageCountPredicate = [NSPredicate

NSPredicate on nested object / NSSet to filter the result during NSFetchRequest

一个人想着一个人 提交于 2019-12-01 14:17:43
I want a simple predicate that returns me all the groups which have mode = 0 and the mode of the enrollments in the group = 0 To be precise i need a predicate to access the nested object properties. Somehow a predicate like: [NSPredicate predicateWithFormat:@"mode = 0 AND enrollments.Enrollment.mode = 0"] the above predicate is wrong and obviously doesn't work. EDITED: I have given a go to the following predicate too but been unsuccessful. [NSPredicate predicateWithFormat:@"mode = 0 AND ALL ( SUBQUERY(enrollments,$varEnrollment,$varEnrollment.mode = 0))"] I need result which contains all

NSPredicate on nested object / NSSet to filter the result during NSFetchRequest

谁说胖子不能爱 提交于 2019-12-01 12:48:07
问题 I want a simple predicate that returns me all the groups which have mode = 0 and the mode of the enrollments in the group = 0 To be precise i need a predicate to access the nested object properties. Somehow a predicate like: [NSPredicate predicateWithFormat:@"mode = 0 AND enrollments.Enrollment.mode = 0"] the above predicate is wrong and obviously doesn't work. EDITED: I have given a go to the following predicate too but been unsuccessful. [NSPredicate predicateWithFormat:@"mode = 0 AND ALL (

iOS Share extension how to support *.wav files

我与影子孤独终老i 提交于 2019-12-01 09:50:09
As the title states, I want my extension to show up when the users share *.wav files I've come across the following apple documentation: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8 I'm trying to figure out how to actually use what is mentioned in the documentation to do so. The documentation leaves me with the feeling I have most if not all the pieces I need, but not how they go together. I understand that I'll most probably have to build a "SUBQUERY(..)" statement, but where does it go

NSPredicate traversing relationship (StackMob)

放肆的年华 提交于 2019-12-01 08:15:26
I have been scouring Apple's Predicate Programming Guide and SO as well, trying to determine the correct way to write a predicate for a certain fetch request. It seems like the way I am attempting to use dot notation to traverse a relationship is not being respected by the request. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:context]; [fetchRequest setEntity:entity]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"project.user == %@", self.user]; [fetchRequest setPredicate:predicate]; User, Project, and Task are all core data

iOS Share extension how to support *.wav files

血红的双手。 提交于 2019-12-01 06:43:48
问题 As the title states, I want my extension to show up when the users share *.wav files I've come across the following apple documentation: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8 I'm trying to figure out how to actually use what is mentioned in the documentation to do so. The documentation leaves me with the feeling I have most if not all the pieces I need, but not how they go

NSPredicate traversing relationship (StackMob)

百般思念 提交于 2019-12-01 05:56:28
问题 I have been scouring Apple's Predicate Programming Guide and SO as well, trying to determine the correct way to write a predicate for a certain fetch request. It seems like the way I am attempting to use dot notation to traverse a relationship is not being respected by the request. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:context]; [fetchRequest setEntity:entity]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"project.user ==