App crashes while loading with error in main.m - iphone

I'm trying to recover an app that I accidentally deleted and managed to do it through the organizer, however, now when I try to run it on the simulator or iphone, it crashes with an error popping up in the main.m file:
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
The error occurs in the "return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));" section of the file with the SIGABRT error. I am using Xcode 4.2 with ARC on. I am testing it on ios 4.3 and ios 5.0. The app was working before and in fact, is on the app store right now. Anything would help

If you look in the debugger it will probably tell you what caused the error. This has happened to me before, due to insufficient memory (too many items on screen at once). Either way, look at the target debugger for what caused the error.

Usually when I get similar errors is because there is a broken link on the Interface Builder. Maybe you've changed the name of an IBOutlet and forgot to connect it again.

If you are using Storyboards, make sure you haven't hooked up duplicate referencing outlets or reference outlets that aren't there anymore in your code. In other words, if you dragged from a button on your view controller to your code and then the property or method has changed at all, you can get this error.

happened to me, looked in the debugger and found it mentioned a name I given to an action, but deleted it after I created it both viewController .h and .m so for some reason that old action created with a different name, still lingered somewhere... so I copied my code and pasted it on a new prog. Of course, it was a very small one view app so it was easy...

I've seen this happen before if the following build settings are not there. OTHER_LDFLAGS = -ObjC -all_load
This is under Linking in the target.

Not sure what the error message is—that would be helpful. But are you importing AppDelegate.h?

It happened to me and all I did was changed the name of my image view and than changed it back later. But, I forgot to disconnect the other name after I deleted it. However, once I disconnected it from interface builder it worked.

Crashed with LLDP debugger I changed to GDB and then it worked.
I got stuck with this problem too but not all the time only 1/2 launch. Absolutely no error in the console no nothing, just a signal SIGARBT. My AppDelegate did not even went to didFinishLaunchingWithOptions. Changing the debugger back to GDB (Edit Scheme… > (Info tab) Debugger > LLDB) solved the problem.

To fix it, click on mainstoryboard i.e. Interface Builder, select the File Inspector tab, and uncheck Use autolayout.
Alternatively, you can target iOS 6.0+-only devices and change the minimum target, if you absolutely must have autolayout.
This problem occurs due to mismatch in versions of xcode and source of learning programs from.

Related

signal SIGABRT Error when trying to run xcode 5.0 app

Sorry to ask, I have tried everything I have read online, but I keep getting the SIGABRT Error when I try to run an app.
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Error code comes up beside the return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
line.
The debugger just states
2013-10-18 10:29:45.270 Black History Month[733:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x903f770> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(0x14a3052 0xea3d0a 0x14a2f11 0x9b3032 0x924f7b 0x924eeb 0x93fd60 0x23291a 0x14a4e1a 0x140e821 0x23146e 0x233010 0x1314a 0x13461 0x127c0 0x21743 0x221f8 0x15aa9 0x138dfa9 0x14771c5 0x13dc022 0x13da90a 0x13d9db4 0x13d9ccb 0x122a7 0x13a9b 0x2712 0x2685)
terminate called throwing an exception
I have tried producing a couple different apps and always get this error so cannot release, I have now tried a simple uiwebview app and the same thing keeps happening. I have tried running on many different deployement targets with no successful outcomes.
I have tried resetting the simulator, restarting both xcode the simulator, and computer multiple times, turned off auto layout for the xib file. No luck. Any ideas?
Thanks in advance
This has nothing to do with Xcode. Your application has thrown a run time exception. Since the exception is not caught anywhere it is poped upto main. Set an exception to All Breakpoint to figure out whats wrong. If your app worked in Xcode 4 then check the iOS deployment target. I suspect it has to do with iOS 7 which is default target in Xcode 5.
I also had this error. After spending so much time, I found how to fix it. First of all go the console and see where is the error (mine was related to storyboards and its code) The way I fixed my error was by going in story board. Below the iPhone screen, there will be small yellow button. Right click on it and you will see that is causing error. Delete(x) it if there is yellow error sign.
If this does not fix your error then try to make new project and then replace its blank files with old files of your old project. I had same error in very beginning and by doing this program run without any error.
Other people suggests by restarting your laptop and running it again, reseting the iOS simulator, or changing iOS debugger (however this does not work in latest x code since there is only one debugger)
Hope this helps
From the error message
[<UIApplication 0x903f770> setValue:forUndefinedKey:]: this class is
not key value coding-compliant for the key view.
one can see that you try to set the view property on an instance of UIApplication,
but UIApplication does not have a view property.
To find the point where the error occurs, set a breakpoint on
"All Objective-C Exceptions".
I also had this error. After spending so much time, I found how to fix it. First >of all go the console and see where is the error (mine was related to storyboards >and its code) The way I fixed my error was by going in story board. Below the >iPhone screen, there will be small yellow button. Right click on it and you will >see that is causing error. Delete(x) it if there is yellow error sign.
I would +1 Viraj's answer, but I don't have the reputation. I can verify that in a Swift project in X-Code 6, this solution works. My problem was:
My app ran great on the initial view controller and on the 2nd screen, but upon trying to load the third view controller, my app would crash and return the "SIGABRT" error.
The Fix was indeed to go to the screen where my app was crashing, right click on the yellow icon (which is ABOVE the view in my version of X Code). I had two IB Outlets assigned to views, which did not have connections to the code. I did not need them too (they were old), so I deleted both from within the Outlets inspector in the right sided attributes inspector.

EXC_BAD_access code=2 address 0x8

I have an app that I've been working on, which worked perfectly on iOS 6 in XCode 4.5, but now I downloaded XCode 5 with iOS 7 and get this error,
Thread 1: EXC_BAD_access code=2 address 0x8
in main.m :
#import <UIKit/UIKit.h>
#import "TestAppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([TestAppDelegate class]));
}
}
I downloaded iOS 6 sdk and the code work perfect on iOS 6 sdk yet but with iOS 7 , i get this error , and I don't know why?
I try to debug this but get no information about the crash. I read something about zombies and enabled it by going to Product->Edit Schema->Diagnostic->Enable Zombie Object. But even after this I didn't get anything helpful.
Any pointers?
I'd like to expand on the tip given by Vinzzz but differing slightly (exception not symbolic breakpoint).
The problem here is that the program has stopping on an OS caught exception (bad access). You need to go one step earlier than this, to see the exception in code which would lead to an iOS exception. Go to the breakpoints tab on the left Xcode screen panel section (Breakpoint Navigator). Then at the bottom of the panel there should be a + sign. Click there and add an 'Exception Breakpoint'. Re-run your program and you should now be breakpointed when the problem is attempted to be introduced into the OS environment. This gives information about who and what is the cause.
When you get to the (lldb) prompt try to hit the continue button. That may reveal the underlying error message in the top of the debugger console. Look for the top of the bold text to see what possible object is causing the problem. This type of error usually refers to an attempt to access an object that has been deallocated.
I had this error too because in my user model class I had an extra object I declared as
var image = UIImage()
I didn't use it for that task I took it off from model class, my app didn't crashed I would check model class.

NSInternalInconsistencyException uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: NSBundle with name

I'm having a strange error in my iOS app. Everything was working well since yesterday and today I made some improvements on a view controller that has nothing to do with the AppDelegate and when I tried to test the changes I've made on the simulator, I got this error :
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in
bundle: 'NSBundle
(loaded)' with name 'xxx'
I searched a lot in Google and this website to try to find a solution, and all the topics I found were talking about problems with xib files. However, I'm using Storyboards and my app is iOS6.1 only so I have no xib files ... I also checked that the storyboard was included in "Build Phases" and everything seems right :s. I know that this error could happen when some files were included in the Finder but not in Xcode, however that's not the case for me: I always included the files directly in Xcode and checked the "copy files to directory" option. I even tried to revert the changes I made, and I still have this issue so I really don't know what is going on. My app is really simple at this stage, I just have a couple of view controllers connected through a navigation controller and 1 external framework (AFNetworking). My AppDelegate (where the error seems to happen) is clean: I didn't add anything to the sample code that was provided by Xcode.
I'm really stuck with this issue and I hope you could find a way to help me solve it.
First, try using the Xcode/Product/Clean menu item. If that doesn't do it then go to the Organizer, switch to Projects, and delete the Derived folder for your project. If you do the second, quit Xcode and start again just to be sure all is wiped.
EDIT: if you want, zip the thing up, and send it to my email address in my profile. I can only spend a few minutes with it but will at least take a look.
EDIT2: learned a few things here, but no fix. What you are seeing is that the StoryBoard is trying to product the rootViewController, and fails - the app delegate never even gets messaged. The EventsTVC class gets sent initWithCoder:, and then later is asked for its nibName, which it returns. This nibName is an identifier into the storyboard - and is what internally Apple must be using to construct a nib. However, that fails. You can see the name by adding this to EventsTVC:
- (NSString *)nibName
{
NSLog(#"NIB NAME %#", [super nibName]);
}
What I did to reproduce the problem was create a new StoryBoard Master/Detail app, and add this to the rootviewcontroller:
- (NSString *)nibName
{
NSLog(#"NIB NAME %#", [super nibName]);
return [[super nibName] stringByAppendingString:#"foo"];
}
This of course makes the nibName bogus, and it causes the app to fail where yours does, with the same message.
You have two choices: you can burn a DTS incident on this - see if you can get Apple to fix it (might take a few days), or you can just redo the project, and copy as much of what you can back into the new App.
In any case it would be really great if you could send the same zip file to Apple and create a bug report on it. I suspect that the storyboard is corrupt internally, but there are no public methods to use to delve into it (look at UIStoryBoard).
Since ios7 and Xcode 5, it does this to me every morning ! I don't know what kind of mess they did in xcode but it's annoying. If you want to pass this bug, go to organizer, then delete the "derived data" (if somehow it doesn't want to delete, go delete it in terminal with a good old rm -rf), then run you app, it will crash again, this time go to you simulator and click on reset settings and everything. Now run your App again your done :) !

Xcode 4.5.2 simulator Crashes in main.m file

#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
I get a crash where is starts to say return UIApplication
I am creating an app that is all connected to one tab view and everything works except for one page. I have multiple other pages that work, but once I get on to that page it crashes on this line of code.
I had the same maddening issue. I found that constraints were the problem (some could not be resolved). I removed all my constraints (from the detail scene) and it worked again.
The "All Output" section of the debugger gave me the clue I needed in the end. Resetting the simulator and rebooting had no effect. I hope this helps someone.

My app crash on exit after upgrading to iOS 4.0 sdk. How to fix this?

Everytime I quit the app in the simulator.
The console display this error message:
*** -[NSThread _nq:]: message sent to deallocated instance 0x6d770e0
Looks the app try to access an deallocated instance.
But I cannot find it anyhow, even using the instrument.
I can't find the line of code that cause the problem.
p.s. I have already tried any ways that I know to debug this problem. but no success yet.
I enabled NSZombie and use instrument to help me to find out the error. But the error report did not point to any of my own code. I have no idea why this happen.
Double click on your executable in the left pane in XCode, go to the arguments tab, add a new one named NSZombiesEnabled and set its value to YES. This will set all deallocated instance to an NSZombie and you'll be able to tell what type is being deallocated.
NOTE: THis must be turned off after or your app will never release memory!
Fixed, this problem is that I access interface objects not in the main thread. you can do so by [self performSelectorOnMainThread....].