views:

178

answers:

4

I have the code [window addSubview:[self.mvController view]]; where mvController is a view controller and whenever I run the program (device and simulator) it crashes.

+1  A: 

What's the error message you get when the crash occurs?

NSResponder
+1  A: 

Could you please post the entire function where this code is being called, as well as the error message.

The first thought that occurs to me is has mvController been initialized? The app would crash if you try and add nil as a subview, which would be the case if you didn't initialized the view controller first.

Andrew Johnson
A: 

maybe [window addSubview:[mvController view]]; ?

sakrist
I've tried that and it still crashes, Thanks though!
Mr. Man
A: 

Never mind, it turns out that the program was releasing something too early, thanks though!

Mr. Man