I saved CoreData under the entity name Story
.The contents are only attributes, and
This is the configuration.
Use NSPredicate CONTAINS to do this
NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"Story";
request.predicate=[NSPredicatepredicateWithFormat:@"tap_countCONTAINS'0'";
NSArray* result = [[DataBaseManager shared].moc executeFetchRequest:request error:nil];
When I wrote , I got 3 NSManagedObjects with tap_count 0,10,20.
But I only want to take tap_count 0, so
request.predicate=[NSPredicate predictorWithFormat:@"tap_count=='%d',_tapCount];
or something like that
request.predicate=[NSPredicate predictorWithFormat:@"tap_count MATCHES' [%d]'',_tapCount];
I've tried many things, but I can't take them out.
Please tell me how to take it out.Thank you for your cooperation.
objective-c coredata
Now you can take it out.
When using the =
operator, it is not ==
but =
.
NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"Story";
NSSstring*predicateStr = [NSSstring stringWithFormat:@"tap_count='%d',_tapCount];
request.predicate = [NSPredicate withFormat:predicateStr];
NSArray* result=[DataBaseManager shared].moc executeFetchRequest:request error:nil
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
581 PHP ssh2_scp_send fails to send files as intended
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.