OS4 - window addSubview
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,
TeeQ: "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.
精彩评论