The question might sound pretty naive, ut this is really troubling me. I am trying to set an instance variable by calling an instance method method of a ViewController from another view controller. Basically here are the steps
- I am in ViewController1
- Initialized an object of ViewController2
- Called an instance variable to set some values to the instance variable of ViewController2
- Then finally called the presentModalViewController to load the view controller
- Using the variables in viewWillAppear method, But the app crashes and on debugging it shows BAD_EXEC
I have tried printing the same in instance method and it prints there but crashing when trying to use somewhere outside the method.
I have also defined the property and also ynthesized the variable.
The only problem I can figure out is I am initializing the variable in methos ...Does that limit the scope of the variable.
Any kind of help would be highly appreciated.
Thanks in advance!!