Trouble with iOS app force quitting - iphone

I'm having trouble with my first iPhone app that i'm making (sorry i'm a noob).Everytime I launch the application and click on one tab, I get this error.
#import UIKit/UIKit.h
#import "AppDelegate.h"
int main(int argc, char *argv[]) {
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
The line that start at return and ends with class])); is highlighted green and says Thread 1: signal SIGABRT.
I have no idea what this means at all, so if you could help it would be great. Please be as specific as you can be. I'm using the latest xcode.
Thanks,
Will

Put a breakpoint at the beginning of your method that runs when you hit the "one tab" that causes the error. Then step through until you come to the line of code that causes the app to fail to the line above. That previous line of code will contain your offending issue.

Related

Sometimes my project works fine, sometimes it shows following error in the line mentioned in the code below

#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);//Program received signal: EXC_BAD_Access"
[pool release];
return retVal;
}
You’re accessing bad memory somewhere. Most probably, you're trying to reference a pointer to an object that's been released already, and the debugger has had to roll back to the bottom of the stack. Usually, a hint to the real reason for a crash like this will appear just slightly before "Program received signal: EXC_BAD_Access" in the log.
Good luck.
EXC_BAD_Access means you're overreleasing an object. Run the app using Instruments Object Alloc with Zombie detection enabled to find the culprit.
Your application going to crash that's why you are getting error at this point,
you can check where application going to crash by selecting iOs Simulator 4.3 and lower version.
This may help you to debug the problem.
iOS 5.0 and later never tell where is the issue for that you must have to run you app in lower version then 5.0.

iPhone SDK "clear" function not working-button

I have a question relating to a button I made for my app. I am fairly new to iPhone development so please stay with me. When the "clear" button is clicked, it is programmed to reset the text fields. The other "calculate" function works fine. The app runs perfectly until I press "clear". Then the app will completely freeze. The following is displayed in Xcode.The commented out is the error I get, I think it is some sort of breaker:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
//Above error reads "Thread 1: Program received signal: "SIGABRT"
[pool release];
return retVal;
}
I feel like this is a simple mistake but I am unfamiliar with mobile development and just started it. Any help would be greatly appreciated!!
When this occurs, it usually means Xcode couldn't figure out where something went wrong. The best thing to do is to set a breakpoint in the first line of your -clearButtonWasPushed: method (or equivalent). Run it step by step, and then when it crashes to your main.m code, you'll know which line caused it. You might have overreleased something by mistake...
Alternatively, UITextField has a built in clear button, which you can activate programatically or in IB:
textField.clearButtonMode = UITextFieldViewModeWhileEditing;

NSAutoReleasePool Leaks on allocWithZone

So this has been confusing me for a while. I am running my app in the "Profile" Mode trying to find memory leaks in my app. I think I got all of them expect when I click on the Map part of my application it reports back that a reference to NSAutoreleasePool was leaked from the Foundation Library. I check the trace of the object but it only reports back from the method allocWithZone. It seems to leak only once on matter how many times I alloc and dealloc that view controller. I did a search of my code and the only reference I make to NSAutoreleasePool is in the main.m file. Is this an Apple bug (which I doubt) or am I doing something wrong?
main.m
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Looks like it was an Apple bug. The same amount of memory is leaked in the other question which leads me to believe they are the same bug. I did an extensive code audit and nothing seemed to be working to get rid of the leak. Oh well I hope they fix it soon. NSAutoReleasePool Leaks on allocWithZone

Memory leaks in an iPhone app

I have the following memory leaks in my code. What does it mean? How can I fix this?
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
**int retVal = UIApplicationMain(argc, argv, nil, nil);**
[pool release];
return retVal;
}
Thanks in Advance.
That code is from your main.m file. It seems odd that this part of your code would leak, if at all??
How did you find this leak?
Are you using the simulator or a real device?
If using the simulator you can sometimes have leaks that are not leaks at all, it is always better to test these kinds of things on a real device (which you have not specified). Double check all of your release, retains etc in your code. You might just spot something you have not released. (in xcode 4 use the assistant editor I find it better to spot these kinds of things alt+cmd+enter).
Your question otherwise is hard to answer, you might want to edit it with how you found it and in what environment.
Hope some of this helps
[EDIT] saw you tagged this with cocos2D (what version are you using of that?) there are some reported issues elsewhere on SO with memory leaks using older versions of cocos2D

main.m error in iPhone build

Never thought I'd get an error in this file when I compiled, but after running my app in debug mode, The app stops and highlights the line
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
in my main.m file as a breakpoint. When I run in normal mode, the app just shows a black screen. What does this mean?
(Update)
Okay, nothing has worked so far. Here is the code that is failing:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
The stack says
Pending breakpoint 1 - ""main.m":31" resolved
The weird thing is, I removed the aforementioned view controller that preceded this problem, there are still no warning or errors and I the application still either halts in debug mode or returns a black screen and freezes in normal running mode.
Here is a drop containing two screenshots of my view and window arrangements in my two NIBs in IB. You can also download my full project to browse the code, if you wish. The project is named "iHouse.zip"
http://drop.io/6lhubkb
Otherwise, any other specific code anyone would like to see, I'm happy to paste it here on request. Otherwise, I'm stumped.
Thanks.
Solved....sort of. The "31" in the stack was oddly referring to a random line in the commented out apple disclaimer in the beginning of main.m. I removed this and that problem went away. Still not sure why it suddenly became a problem in the first place.
I compared the code side-by-side with another app and found that I had commented out a critical part of applicationDidFinishLoading in the AppDelegate as #IWasRobbed had suggested.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];
}
else
{
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
Because I was not ready to make this app universal, I commented this part out. In doing so, I took out the crucial piece to tell the app what the heck to load in the first place
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
Thanks everyone for your help. Took all day to find a silly error on my part, but you live and you learn I guess.
It means you probably forgot to hook up a window or view to load after the application launches. Unless you modified the main.m file (which you shouldn't need to), it should be just fine.