Xcode 4.5.2 simulator Crashes in main.m file - iphone

#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.

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.

EXC_BAD_ACCESS when filling input fields using webview

Very strange problem here. I have an app that's entirely based on webview (it just serves up a mobile site). I recently encountered a very strange EXC_BAD_ACCESS issue while running the app in the emulator.
On the login page (which is the "landing" page for the app i.e. it's shown when the app first starts) there's no problem, but on all other pages, when I go to input text in an input field, the app crashes with the EXC_BAD_ACCESS error. Sometime this happens as soon as I type the first letter, sometimes after about two letters in.
Here's the line it's implicating when it crashes (not sure if this means anything in particular):
int retVal = UIApplicationMain(argc, argv, nil, nil);
Any ideas? If you need more details about the app/code snippets, let me know.
Thanks in advance!

handleOpenURL only works when app is already launched, crashes when app is closed

I am using URL Schemes to be able to open my app using a url. It is working fine when the receiver app is running.
The problem however, is if the app is closed. If I type in the url into Safari for example, the app launches and immediately crashes and I'm given:
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Thread 1: Program received signal: "SIGKILL"
I have put an NSLog in didFinishLaunchingWithOptions but it looks like that never gets fired, neither does handleOpenURL.
Why does it do this?
I'd suggest two things:
In XCode 4 - select the Product->Edit Scheme menu and then in the info tab set the Launch radio button to wait for your app to launch.
In the arguments tab under Enviornment Variables - enter the NSZombieEnabled with value YES.
Then - I'd launch the app from XCode and it will wait until you enter the URL in Safari. At this point you're in the debugger and you might be able to get more information.
When this happens to me it's usually some memory thing that I haven't properly initialized in one of the code execution paths.
Lastly -if this is happening on a device (not just in the simulator) sometimes there is more information in the Organizer's console.

App crashes while loading with error in main.m

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.