objective c - NSFetchedResultsController predicate is a little too real time...? -
So I have an NSFetchedResultsController that I activate with ViewDidLoad with managedobjectcontext which has been passed on from the appdelegate on load.
I have put a stigma on some fields, it is called "section number" and says that it is equivalent to 1 in my understanding.
NSFetchResultsController works fine until I use MOContext ...
I use MyMO * newObj = [NSEntityDescription insertNewentity] ...
Start filling in different areas [newobj setName: @ "me"]; [Newobj setAge: 12];
etc ...
Once I put [newobj setSectionNumber: 1] - it gets very quick on it and crashes the app separately. CPCADAADADADADACSSSS leads to.
It all happens on the main thread.
Any ideas why? How can one be around?
UPDATE: This only happens when I use my saveMOC method which is called at the end of the specific thread of the NSXLL parser. I called the Save MOC on a successful parse with [self-demonstratoronMineTrade] Goes on .... if I just add additional managed objects through viewedload (just to check the weather, it is related to threading in some way) problem generation There is not.
So it is clearly anything with the new thread, although the selector should have run on the main thread.
UPDATE # 2: This is my thread for XML parser:
- (zero) getAndParseXML {NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; } Then it is my left hand: The process of this saving purpose is in progress and [managedobjectcontext save: & amp; Error] is more ... but it is not relevant in our case because my method is crashing, I searched through a comment that at the point after the other line where I set the section designer because it is my NSFetchedResultsController The current forecast is equal to DLog (@ "online storage"); NSXMLPers * Parser = [[NSXML Parser Allok] Init With Contains Uberl: URL]; XML translator * translator = [[XML transllator light] init]; [Parser set deliigate: translator]; If ([parser paras]) // // success call MOC change routine on main thread (@ "success parsing"); [Self Performance SelectorManThread: @Sillector (Save MOC) with Object: Translator Waiting Not Available: No]; } Other {DLog (@ "error:% @", [parser parser error]); } [Parsets set deliaget: blue]; [Parser release]; Delaag (@ "XML Parsing Complete"); [Bridge release];
- (zero) Sevmok: (XML translator *) translator {NSDATFormator * Formatters = [[NSDateFormatter alloc] init]; [Format setDateFormat: @ "yyyy-MM-dd HH: mm: SS"]; For (in translation by translator) [Apost * Newpost = [NSTT's DisharNew object FERN: @ "Apest" Manage Object Contains: Managed Object Contex]; // Parse time in NSDAT [Newpost settime: [Format dement string: [Dict octformforci: @ "time"]]] ;; // Author, Category, Description [newPost setAuthor: [dict objectForKey: @ "Author"]]; [New post set category: [Oct. Octofariki: @ "Category"]]; [New post set content: [Dict octforch: @ "description"]]; // Create a post id so that verification will be corrected [newPost set.postid: [NSNumber number with integer: [[Dict objectForcae: @ "postid"] integer value]]]; [New Poststreet Designer: Section Designer]; }
The problem is most likely in NSFetchedResultsController representative methods or in its absence
If you add a new object for any reference and then save the reference, then it changes the store that triggers FRC on any thread to start an update of the table. All index paths change, especially if you set the value for the attributes used in the form of sectionNameKeyPath
if the table demands a cell during the update, then this will be the cause of an accident Because the table can demand a cell on the index path provided by illegal by the inclusion of the new managed object.
Ensure that you apply representative methods of the FRC and that you send the table to send a startUpdate
message, while the FRC will index all its index paths Changes.
Comments
Post a Comment