ios - what happens between willSelectRowAtIndexPath and prepareForSegue? Need debugging advice -


somewhere in between these 2 calls, exc_bad_access (code=2, address=0xa).

the common explanation bad access accessing released object - i've compiled nszombies enabled , yielded nothing. saw 1 reference assigning integer pointer... might have done except i've read through changes i've made since morning (when program worked) , haven't found anything.

the stack frame lists:

- 0 objc_msgsend ... access violation occurs - 1 -[uitableview _selectrowatindexpath:animated:scrollposition:notifydelegate:] - 2 -[uitableview _userselectrowatpendingselectionindexpath:] ... 

neither of uitableview methods public, can't override them see might going on.

although i'm experienced developer quite new xcode , objective-c, appreciate suggested debugging strategies in environment.

tia.

well - found culprit, , @dasblinkenlight suggested, upstream crash. wasn't int assigned pointer... , must odd enough type of access problem zombies couldn't catch it.

the offensive bit of code in table view controller, , called presenting view controller in prepareforsegue:

- (void) initwithdiv: (divisiondef *) selecteddivision {     selecteddiv = selecteddivision; } 

originally selecteddiv declared

divisiondef * selecteddiv 

inside implementation thought private, access through initwithdiv method. though later changed property (strong, nonatomic), program still crashed. when changed line in presenting view controller from

    [(selectdetailcontroller *)segue.destinationviewcontroller initwithdiv:selecteddivision]; 

to

    [(selectdetailcontroller *)segue.destinationviewcontroller setselecteddiv:selecteddivision]; 

presto magico, access violation disappears!

the idea struck me when studying "declared properties" chapter of online documentation apple, , explained setter methods generated @synthesize statement take care of complying memory management attributes defined in @protocol statement.

i find amusing no matter language, memory management lessons seemed learned hard way! suggestions, appreciate support.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -