Hello guys, I'm new to Objective-C programming, I've read about memory management and things has been working well for me until I ran into this error:
EXC_BAD_ACCESS
Here's what I did:
1. I created a class to serve as a data object (like a bean in Java) called ClassA.
2. Inside ClassB(which is a view controller) I have a method where I create an instance of ClassA and fill it with data, then I create an instance of ClassC (also a view controller that has a global variable of type ClassA with property retain) and pass my instance of ClassA to it and then push it on top of my navigation stack, the method ends here.
3. Using the instance of ClassA inside ClassC only works in viewDidLoad, if I try it in any other place inside ClassC (like from inside a function) I get the error above!
Now from my understanding, the class should stay in memory until ClassC is destroyed, so I don't really understand what I'm doing wrong, any help is appreciated.
EXC_BAD_ACCESS
Here's what I did:
1. I created a class to serve as a data object (like a bean in Java) called ClassA.
2. Inside ClassB(which is a view controller) I have a method where I create an instance of ClassA and fill it with data, then I create an instance of ClassC (also a view controller that has a global variable of type ClassA with property retain) and pass my instance of ClassA to it and then push it on top of my navigation stack, the method ends here.
3. Using the instance of ClassA inside ClassC only works in viewDidLoad, if I try it in any other place inside ClassC (like from inside a function) I get the error above!
Now from my understanding, the class should stay in memory until ClassC is destroyed, so I don't really understand what I'm doing wrong, any help is appreciated.