Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 9, 2012, 05:13 AM   #1
jeanlain
macrumors 6502
 
Join Date: Mar 2009
Any ideas why my controller's arrangedObjects is modified so many times?

Hello. I have a tableview whose content is bound to an NSArrayController's arrangedObjects (nothing fancy here). The objects populating the table are entities with many attributes. The controllers is bound to a managed object context.
I want to observe changes in the controller's arrangedObjects property.

Every time I interact with the table in a way that should alter the property (filtering rows, sorting), it appears that this property is changed many times in a row. Like 13 to 20 times when I sort the view by clicking on a column header or when I add a new object to the controller's content. I cannot predict the number of time the property is going to be changed. It doesn't appear to be related with the number of objects populating the view. Note that the app behaves normally. In fact, I haven't noticed anything special before I decided to observe the property.
It doesn't happen to other views that are populated by "simpler" entities with fewer attributes, and bound to other controllers. The arrangedObjects property is changed just once.
Any ideas?
jeanlain is offline   0 Reply With Quote
Old Dec 11, 2012, 11:22 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Without any code, interface files, or core data files, it's rather difficult for me to say why it's behaving that way... honestly, I've only just started my first Core Data Mac app, and I only had a tiny bit of experience with it on iOS... but I suspect if you share any of those files (or even your entire project... or a sampler of the project that exhibits the same behavior...) you'll get some helpful responses.

I would guess you might have some kind of race conditions occurring. IE, maybe different bindings are criss crossing each other and so when one value changes, it sets off a cascade of other changes? Just a guess based off of your description.
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Dec 15, 2012, 08:37 AM   #3
jeanlain
Thread Starter
macrumors 6502
 
Join Date: Mar 2009
I don't think my code should modify the arrangedObject property, when sorting the table for instance. My entities do not react to that. Anyway, this isn't a big issue, I was just wondering.
jeanlain is offline   0 Reply With Quote
Old Dec 15, 2012, 01:13 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by jeanlain View Post
I don't think my code should modify the arrangedObject property, when sorting the table for instance. My entities do not react to that. Anyway, this isn't a big issue, I was just wondering.
If you don't think it should be doing it, then use the debugger. Set a breakpoint on the method. Figure out when and where it's being called from. Work backwards.

You also seem to have another case with fewer calls. So use the debugger on that one, too. Same thing: set a breakpoint, trace who calls it, and work backwards. The goal is to see what a "normal" one looks like, then you can compare and contrast with the "abnormal" one.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
OS X: I wrote an app that enables DualShock controller mapping - pricing ideas? Starfox Mac and PC Games 35 Dec 10, 2014 04:19 PM
EX Hybrid Controller for iPhone 5 - Keyboard and Gaming Controller v3rn iPhone Accessories 3 Jan 3, 2013 07:47 PM
About push view controller into a navigation controller stack. cthesky iPhone/iPad Programming 5 Nov 9, 2012 09:36 AM
Segue from Normal View controller to navigation controller daproject85 iPhone/iPad Programming 0 Sep 29, 2012 04:26 PM
push to a specific view controller regardless of which controller is active johnmerlino iPhone/iPad Programming 2 Jun 19, 2012 03:24 PM

Forum Jump

All times are GMT -5. The time now is 12:55 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC