views:

54

answers:

1

Hi,

I have an app that works fine in OS 3.*...
However, in OS 4, this line of code doesn't seem to work.

[window addSubview:[mainViewController view]];

Is there a different way to add a view to window in OS 4?
Or is it even the wrong way to add a view even on OS 3.*?

Thanks,
Tee

+1  A: 

Q: "why would the [toutImage autorelease]; kill the app?"

A: Because you're releasing an object that you don't own. +[NSString stringWithFormat:] does not return an object that you own (because stringWithFormat: does not contain new, alloc, retain, or copy), so you must not release it. If you do, you'll basically end up with a "double free" (you try to free memory that's already been free'd), and that will crash your app.

Dave DeLong