ios - NSFetchedResultsController triggered by NSManagedObject's refreshObject. Why? -


I have made a NSFetchedResultsController which brings data from Kordata store when starting the FRC So I call showFetch and check the number of items found in frc.fetchedObjects , the result should be as 0.

I'd call each other in code:

  [obj.managedObjectContext refreshObject: obj mergeChanges: NO]  

However, I am also not sure whether it is necessary to have an influence on bringing the FCC some such objects, which were not initially brought out and should not be considered for the queries used.

Edit:

(UrlWeb = NULL) " , version, date Yuarelaksayr]; Frc = [[NSFetchedResultsController alloc] initWithFetchRequest: query managedObjectContext: reference Anubagnampyapth zero Kasnam: zero]; Frc.delegate = self; [FRC performance Fitk: End Edition];

But this happens when I change the query to this version ( urlWebVersion and urlWebDate is NULL for all records):

  query.predicate = [NSPredicate predicate.WithFormat: @ "(cartEntry! = NULL) and ((urlWeb = NULL) or (urlWebVersion! =% @) Or (urlWebDate & gt;% @)) ", version, date URLXer];  

* edit # 2

here the minimum code sample shows strange behavior (no error during execution):

  - (BOOL) application: the application (UIApplication *) FinishLaunchingWithOptions: (NSDictionary *) launchOptions {NSError * Error; // Create an empty unit with optional field attr1 (string) and entry 2 (date) unit * E = [NSEntityDescription insertNewObjectForEntityForName: @ Managed object contexts in "Entity": [Self-managed object contexse]]; Save the save unit [_managedObjectContext: & amp; Error]; // Setup result control NSPredicate * pred = [NSPredicate predicateWithFormat: @ "(attr1! =% @) And (attr2! =% @)", @ "", [NSDT new], zero]; NSFetchRequest * query = [[NSFetchRequest alloc] initWithEntityName: @ "unit"]; Query.predicate = pred; Query.sortDescriptors = @ [[NSSortDescriptor sortDescriptorWithKey: @ "attr1" ascending: no]]; Frc = [[NSFetchedResultsController alloc] initWithFetchRequest: query managedObjectContext: _managedObjectContext sectionNameKeyPath: zero cachename: zero]; Frc.delegate = self; // Load data [frc showFetch: & amp; Error]; // Output # 1 NSLog (@ "% ld", frame.Object coat); [_managedObjectContext refreshObject: e mergeChanges: NO]; Yes come back } - (Zero) Controlled Change Changed Content: (NSFetchedResultsController *) Administrator {NSLog (@ "% ld", Controller. Field Objects Coat); }  

Output:

  2015-01-22 22: 53: 44.293 Korardabag [10740: 1445186] 0 2015-01-22 22:53: 44.317 Kordetabug [10740: 1445186] 1  

to your problem that NSPredicate Milan The difficulty is ! = on a zero value. For example, edit your 2nd line:

  [NSPredicate predicate.WithFormat: @ "(attr1! =% @) And (attr2! =% @)", @ "" , [NSDate new], zero];  

As you know, Fetch returns zero after request. (There is an extra zero, but it does not affect anything). But to change it:

  NSPredicate * pred = [NSPredicate predicate.WithFormat: @ "(attr1! =% @) || (attr1 == zero)) and ((attr2! = % @) || (attr2 == blue)), "@" ", [NSDT new]];  

Returns the institutions, although it is reasonably similar to

This document is behavior, although the link to follow for so many per-intuitive Has worked hard, see subsection in "using tap values".

It is not clear that the reason for refreshing the object is to suddenly match; This may be a bug, however, looking at the above documents, ! = should not be used for values ​​which can be zero (unless ! = Zero ) does not add a (x = zero) . A little disturbing and counter intuitive


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -