Reputation: 11
My iPhone app is crashing like crazy. I need some help, or really direction.
Quick background: I don't know how to program that well. I've only been doing it for a few months and I'm pretty sure I didn't make this app in the best possible way, or even close.
The app is basically a menu screen with 10 buttons. Each button leads to 3 pages and the navigation will take you back and forth, and back to the main menu. It only has one view and all of the images load as you start the app. All of the images are hidden at first, and as needed they will be shown (hidden = NO).
The app loads up very slowly and then functions exactly as needed. After clicking through about 15 of the images, it will crash.
I've used instruments (not fully sure how to yet) but it doesn't show any memory leaks. It shows "low memory" a bunch of times before crashing.
So time for my questions. I apologize that these are very amateur. This is the first time I've seen any crashes in my apps, and this one seemed so simple to me. It has a lot more imagery than anything I've done before.
Without starting the app over from scratch, is there anything I can do to fix the issue and eliminate the crashes? I don't fully understand how to handle memory (obviously). I know that anytime you alloc something you should release it, but I don't know that I ever do alloc it. All I'm doing is showing and hiding images.
If I have to start over from scratch, what is the best way to do an app like this (similar to a book. main window for navigation, and 10 buttons that lead to 3 full screen images each)? I've never worked in more views than the utility template.
What other information can I provide you to help me?
I appreciate this! I created this app for a friend and I've been struggling for a few days trying to make it right.
EDIT:
(add your analyze details and code here). Put 4 spaces in front of your code and ensure formatting.
- (IBAction)pressNext:(id)sender
{
if (num == 11)
{
peteNotes1.hidden = YES;
//[peteNotes1 release], peteNotes1 = nil;
peteBio.hidden = NO;
num = 12;
//[self playRandomSound];
}
else if (num == 12)
{
peteBio.hidden = YES;
//[peteBio release], peteBio = nil;
petePic.hidden = NO;
next.hidden = YES;
num = 13;
//[self playRandomSound];
}
else if (num == 21)
{
eddieNotes1.hidden = YES;
//[eddieNotes1 release], eddieNotes1 = nil;
eddieBio.hidden = NO;
num = 22;
//[self playRandomSound];
}
else if (num == 22)
{
eddieBio.hidden = YES;
//[eddieBio release], eddieBio = nil;
eddiePic.hidden = NO;
next.hidden = YES;
num = 23;
//[self playRandomSound];
}
Upvotes: 1
Views: 2005
Reputation: 39296
Please add some code and I'll add more details.
Two things you can do right now:
Specifically, the four rules on the second page.
Don't start over - stick with it and understand what's going on. That's the best way to learn. It's hard at first but you'll get it soon.
[2 cents]Other advice - and this is my personal opinion. Learn how to code the apps from scratch and then use interface builder as a convenience (not a crutch). I like the Zdziarski early iPhone SDK book for that reason. I realize others may not agree (and that's fine) but starting with code really helps you understand what's going on better.[/2 cents]
EDIT:
After looking at the code, I realized fixing this is beyond the scope of the SO question. But, I do have a few pieces of advice where to focus.
Hopefully the initial pointers and these help you going a little closer to the right direction.
Upvotes: 1