My phone app is suddenly crashing because of the main.m file - iphone

Suddenly when I try to run my app it immediately goes to the main.m file and shows me this SIGABRT error which I'm going to assume is Signal abort. I just can't figure out why that is happening. And I'm not sure what I am looking at in my debugging area. Please help!
#import <UIKit/UIKit.h>
#import "Mct2AppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([Mct2AppDelegate
class]));
}
}
Debugger Output:
Attaching to process 8004.
Pending breakpoint 1 - ""main.m":17" resolved
Couldn't register com.ebonybutler.Mct2 with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Current language: auto; currently objective-c
Second Debugger Output since restart:
2012-02-29 16:46:45.561 Mct2[319:f803] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "Menu" nib but the view outlet was not set.'
* First throw call stack:
(0x13bb052 0x154cd0a 0x1363a78 0x13639e9 0xd7f0d 0xd83a9 0x2415e2 0xd85cb 0x25e4 0x13bcec9 0x155c2 0x1555a 0xbab76 0xbb03f 0xba2fe 0x3aa30 0x3ac56 0x21384 0x14aa9 0x12a5fa9 0x138f1c5 0x12f4022 0x12f290a 0x12f1db4 0x12f1ccb 0x12a4879 0x12a493e 0x12a9b 0x2032 0x1fa5)
terminate called throwing an exceptionCurrent language: auto; currently objective-c

Simple fix, if you're using iOS simulator, just close it down and rerun the project

This is Happens because your application getting terminate.
Try the following things in the below order:
Make sure all only one program is being debugged in XCode, close other running instances.
shut down your system and restart it before doing third steps.
Restart XCode, most of time this is take care of the issue.
If you are running this on the device and is still not working restart the device and try again.
It Really Work.

Related

Application crashes when showing another window, but only when not debugging

I'm an iOS-developer trying to make a small macOS-application.
I have the storyboard, and have two NSWindowController's with their viewController.
When clicking a button in the first (initial) controller, I want the other window (with its viewController).
I have tried two things:
Create a segue between VC1 and Window2, naming it and invoking it.
Instantiate with self.storyboard?.instantiate(..).
Both of these work - when I run this through Xcode. But if I close Xcode and just run the resulting product, it crashes as soon as I try to open the next viewController, saying:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [32282]
Application Specific Information:
Performing #selector(ok:) from sender _NSPaddedButton 0x600003d0ac40
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.my.app 0x000000010d3e998e FirstViewController.openFile(at:) + 734 (SecondViewController.swift:44)
1 com.my.app 0x000000010d3e95e9 closure #1 in FirstViewController.openFile(_:) + 249
I'm now using this to instantiate it:
if let w = storyboard?.instantiateController(withIdentifier: "secondWindowIdentifier") as? NSWindowController{
if let d = w.contentViewController as? SecondViewController{
d.doSomething(someData: myData)
self.presentAsModalWindow(d)
}
}
I figured it out. It wasn't clear in the provided error, but after testing a few more times, I noticed it was sometimes showing a different error. I found one mentioning a WebView I had placed in the next view.
I had simply written import WebKit in the file I needed it, and hadn't added it to linked frameworks in the project's general tab. Not sure why this 100% didn't crash in the debugger, and 100% crashed on product, but oh well.

Xcode 5.1.1 Thread 1: signal SIGABRT

When i run my app, after a while it stops working and say thread 1: signal SIGABRT. it says it on this code:
#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;
}
It says it on this line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
SIGABRT means an exception was triggered. The console log will print the exact exception message, and you need to look at that (post it here).
The problem is probably in your UIApplicationMain method
To Expand on user3109992 answer a SIGABRT usually means an exception was thrown. Generally you want to enable a global exception breakpoint so that your program will be stopped on the line of code that generated the exception rather than just crashing on main so that you can gain some meaningful information as to what happened.
To set a global breakpoint use the breakpoint navigator (looks like a diamond) on your left bar (or command 7). On the lower left click the + icon and choose "Exception Breakpoint". Now your program will crash at the point the exception is thrown. However this still won't print the actual exception to the console.
To print the exception to the console when the crash occurs select the stack frame that says something like "objc exception throw", it will be at the top of the left window. If your running on simulator type: po $eax and in general the exception will be printed to the console. Note that sometimes the register where the exception is located is different if your on a device or the 64 bit simulator so you can type: "register read" and it will give you a list of registers. The one at the top holds the exception so you can type: "po " to see it. You can have the exception print automatically when your program crashes at main by setting "Log Exceptions" in the scheme (product -> scheme-> edit scheme), accessed by choosing the diagnostic tab in the edit scheme window. However if you have a breakpoint set then your breakpoint will stop the program before the debugger gets a chance. I prefer the breakpoint approach because I usually want to poke around to understand more of whats going on when the app crashed.
I'd suggest you go back and watch some of the debugging and LLDB videos from the past couple of WWDC's as it sounds like you don't have a whole lot of experience with the debugger. The beginning videos have a ton of useful information.

iOS - Video playing gives errors

When I follow this tutorial, it gives me an error on the [playercontroller release]; line, so I remove it, and then it gives me these errors when I try to run it.
I tried making another app to test the video, and it works seamlessly, but it will not work in my main app. Can anyone help?
And when I reimported the framework, and tried to play the video, it gives me this error:
2012-08-17 11:27:03.174 LYWAM Tour[768:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x1e15022 0x10fdcd6 0x1dbda48 0x1dbd9b9 0xba253b 0xba24c5 0x54ac 0x1e16e99 0x26314e 0x2630e6 0x309ade 0x309fa7 0x308d8a 0x2882cf 0x2885e6 0x26edc4 0x262634 0x16f7ef5 0x1de9195 0x1d4dff2 0x1d4c8da 0x1d4bd84 0x1d4bc9b 0x16f67d8 0x16f688a 0x260626 0x24cd 0x2435 0x1)
terminate called throwing an exception(lldb)
I take it GVE1ViewController is a class you wrote yourself? Does it definitely implement a method called GrommeVideoExcerpt1? Is what you assigned to the variable actually an instance of GVE1ViewController (or a subclass?) Put in an NSLog to check that it really is an instance of GVE1ViewController.
To do the NSLog, you need a line of the form:
NSLog(#" My controller = %#", myVar);
where myVar is whatever variable you have containing a reference to the GVE1ViewController.

clang failed with exit code 1 error

I have downloaded a sample code of OpenEars form the web, in that at a place these statements were using:
#autoreleasepool {
…
}
which was giving error: Unexpected '#' in program, then I replaced these lines of code with:
NSAutoreleasePool *pool = [NSAutoreleasePool new];
…
[pool drain];
and now I am getting error: "clang failed with exit code 1 error".
Does any one know how to solve this?
I am using XCode 3.2.5
You definitely want to go back to #autoreleasepool{} but it sounds like the issue is in the compiler/arguments though. That may be difficult to debug, depending on how old the project was. Are you using the latest Xcode, and if so, can you "upgrade project settings"?

How I can backtrack to the first failed in xcode 4

my apps crash to this part of code
int main(int argc, char *argv[]) {
#autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, nil);
return retVal;
}
}
So, where in xcode 4 i can see list of things that the program did before he goes to this point, In clear I want a know at what line the program crash in my code?
If you're seeing that then it's highly likely your program has terminated due to an uncaught exception. Take a look at this question to see how to set a breakpoint in objc_exception_throw which will then help as you'll be dropped right into the code that's causing the exception to be thrown.
Did you enable Zombies? To do it do the following:
1) Click on your app name(next to the Run and Stop buttons on top)
2) Click "Edit Scheme..."
3) In "Memory Management" put a tick on "Enable Zombie Objects"
Or you can get there by clicking "Product" --> "Edit Scheme..."
Hope it helps