Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Poy77

macrumors newbie
Original poster
Sep 5, 2010
18
0
I have started my app with 3.2 sw and tested it with iPod Touch 2nd gen. Now I added support to iPad. In both devices the current sw version is IOS4.2.
iPad crash in second run but iPod not. It seems that iPad load old view from memory even I have deallocated it. iPod starts always with the new view. I want that it starts always from the beginning.

I don't use UIViewController app, it is UIView:
aViewController = [[UIViewController alloc] initWithNibName:mad:" ...

If I now generate new template project, I can see that there is lot of new methods. I am not familiar with them.
 
So you looked them up in the documentation and read what it had to say right?
Actually yes, but maybe not enough. Why I am asking here, I thought that it could be just a small thing, which I have missed.
I debugged that it chashed in one of the UIView classes:
Code:
- (void)drawRect:(CGRect)rect {
    // Drawing code
	[currentImage drawAtPoint:(CGPointMake(0.0, 0.0))];
}
Then in first run, following AppDelegate class methods are called:
i)applicationDidFinishLaunching
ii)applicationDidBecomeActive

And in second time:
i)applicationWillResignActive
ii)applicationDidEnterBackground
iii)applicationWillEnterForeground
iiii)applicationDidBecomeActive
 
Last edited by a moderator:
So most likely currentImage is pointing at a released object or similar.
And I don't have any need to save data during backround or support multitasking.

EDIT:

I solved the problem. I had to define non-backround support in plist file.
 
Last edited by a moderator:
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5)

If you need to update a UIView, try using setNeedsDisplay; also, you can try using the
-(void)viewWillAppear.

I am not really clear from your post as to what exactly you are trying to do, but it seems that you're trying to "restart" your app from the beginning everytime it gets launched. Doing the above might a direction you might want to take.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.