how do i fix the sigabrt error?

Hello,

I'm new in IOS programming and I need your help.


When I start my app (Single View Application) in the ios-simulator I become this error:


Thread 1: signal SIGABRT

terminating with uncaught exception of type NSException

code in main.m file:

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[]) {

@autoreleasepool {

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); Here is the error

}

}


I dont understand this error.

Thank you for your help.

Answered by bob133 in 43990022

I think I've figured it out: you said you use a storyboard, but your app is trying to load a nib. That's why it's getting so confused. What you need to do is tell your app that it's supposed to look for a storyboard, not a nib. Here's how:


• Select your project file in the Project Navigator

• In the sidebar with "Projects" and "Targets," select your app under "Targets"

• Click the Info tab

• Expand "Custom iOS target properties" if necessary

• Look for something like "Main nib file base name." If you see it, click it and change it to "Main storyboard file base name."

• Make sure the name to the right matches the name of your storyboard file

• Now build and run.


Hopefully this will clear up the problem. 😉


To recap, an app crashes with the SIGABRT error whenever an exception (a fatal error) is raised and no recovery is possible, such as during the start-up sequence, where any problem is critical.

Okay. Here's a primer on how all this works:


When a chunk of code gets a bad input or something else is seriously wrong, an "exception" is raised, which causes the currently executing code to screech to a halt. If there's a piece of code set up to "catch" the exception and recover from the error (and there usually is for small problems), the app will be able to recover itself. If not (or if the error is considered significant enough), then the app will crash itself. That's what SIGABRT means: it's "signal abort."


The only reason the error appears to be in your main function is that it's really being triggered somewhere in the system frameworks, probably because you have an interface or configuration file set up incorrectly. And since the UIApplicationMain function is the fundamental entry point into the system frameworks and you don't have access to the frameworks' code, the error appears to be in main(). Have a look in the Debug navigator and you'll see where the problem is really being triggered—it usually provides a clue about the nature of the problem.


One last thing: exceptions almost always include a written reason for the fatal error. Have a look in the console output (if you need help getting that to appear, let me know) for a description of the problem and, in some cases, a tip about how to correct it.

Thanks this was a helpful information.

So what i have to do now?

If you need more information about the code, let me now.


Debug navigator:


*** First throw call stack:

(

0 CoreFoundation 0x00a3b214 __exceptionPreprocess + 180

1 libobjc.A.dylib 0x004fbe42 objc_exception_throw + 50

2 CoreFoundation 0x00a3b13d +[NSException raise:format:] + 141

3 UIKit 0x011ca2ed -[UINib instantiateWithOwner:options:] + 554

4 UIKit 0x011ccfd2 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 247

5 UIKit 0x00dcabff -[UIApplication _loadMainNibFileNamed:bundle:] + 72

6 UIKit 0x00dcb032 -[UIApplication _loadMainInterfaceFile] + 292

7 UIKit 0x00dc9403 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1575

8 UIKit 0x00debf67 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3077 + 68

9 UIKit 0x00dc68c6 -[UIApplication workspaceDidEndTransaction:] + 163

10 FrontBoardServices 0x03578a77 __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71

11 FrontBoardServices 0x0357854e __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54

12 FrontBoardServices 0x03595594 -[FBSSerialQueue _performNext] + 184

13 FrontBoardServices 0x035959cb -[FBSSerialQueue _performNextFromRunLoopSource] + 52

14 FrontBoardServices 0x03594cc7 FBSSerialQueueRunLoopSourceHandler + 33

15 CoreFoundation 0x00955d4f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

16 CoreFoundation 0x0094b9db __CFRunLoopDoSources0 + 523

17 CoreFoundation 0x0094adf8 __CFRunLoopRun + 1032

18 CoreFoundation 0x0094a736 CFRunLoopRunSpecific + 470

19 CoreFoundation 0x0094a54b CFRunLoopRunInMode + 123

20 UIKit 0x00dc61af -[UIApplication _run] + 540

21 UIKit 0x00dcb38f UIApplicationMain + 160

22 Kapitel2 0x0002ea7a main + 138

23 libdyld.dylib 0x02f4da21 start + 1

24 ??? 0x00000001 0x0 + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)

Have a closer look at lines 2-3 of the callstack, particularly the method signatures in boldface:

2 CoreFoundation 0x00a3b13d +[NSException raise:format:] + 141


3 UIKit 0x011ca2ed -[UINib instantiateWithOwner:options:] + 554

The exception is being raised during the nib loading process, which likely means that something is incorrectly configured in your nib. Was there anything else printed along with this call stack?

No there wasn't anything.

A question, what is nib?

What can I exact see on the 2 and 3 line?

Sorry for the Correction. It was my fault.

Sorry for confusing you with terminology—a "nib" is another name for the user interface files you create using Xcode's graphical Interface Builder feature. At runtime, those nib files are loaded by the system code and converted into actual views and other objects. It's commonly spoken of as thawing out the "frozen" version in the nib. So, since you were having trouble with reading the call stack, let me explain that: each row represents some function or chunk of code, and the row immediately below it is whatever "called" it (caused it to run). So your app's fundamental main() function is near the very bottom; main() calls the function UIApplicationMain(), which runs a bunch of hidden setup code (lines 4-20), until it gets to the point that it needs the user interface to be ready. At that point (line 3) it calls the actual loading code, -[UINib instantiateWithOwner:options:], which apparently can't do its job because it calls +[NSException raise:format:], which triggers all of the error-handling behavior. Again, the error happened because UINib got confused trying to load your user interface file.


Usually, though, there will be additional output in the console detailing the nature of the problem. I'd be surprised if there isn't one. Would you paste the complete console output you get from one whole run of your app from launch through the crash?

Okay, good information.


*** First throw call stack:

(

0 CoreFoundation 0x00a33214 __exceptionPreprocess + 180

1 libobjc.A.dylib 0x004f3e42 objc_exception_throw + 50

2 CoreFoundation 0x00a3313d +[NSException raise:format:] + 141

3 UIKit 0x011c22ed -[UINib instantiateWithOwner:options:] + 554

4 UIKit 0x011c4fd2 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 247

5 UIKit 0x00dc2bff -[UIApplication _loadMainNibFileNamed:bundle:] + 72

6 UIKit 0x00dc3032 -[UIApplication _loadMainInterfaceFile] + 292

7 UIKit 0x00dc1403 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1575

8 UIKit 0x00de3f67 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3077 + 68

9 UIKit 0x00dbe8c6 -[UIApplication workspaceDidEndTransaction:] + 163

10 FrontBoardServices 0x03570a77 __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71

11 FrontBoardServices 0x0357054e __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54

12 FrontBoardServices 0x0358d594 -[FBSSerialQueue _performNext] + 184

13 FrontBoardServices 0x0358d9cb -[FBSSerialQueue _performNextFromRunLoopSource] + 52

14 FrontBoardServices 0x0358ccc7 FBSSerialQueueRunLoopSourceHandler + 33

15 CoreFoundation 0x0094dd4f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

16 CoreFoundation 0x009439db __CFRunLoopDoSources0 + 523

17 CoreFoundation 0x00942df8 __CFRunLoopRun + 1032

18 CoreFoundation 0x00942736 CFRunLoopRunSpecific + 470

19 CoreFoundation 0x0094254b CFRunLoopRunInMode + 123

20 UIKit 0x00dbe1af -[UIApplication _run] + 540

21 UIKit 0x00dc338f UIApplicationMain + 160

22 Kapitel2 0x00026a7a main + 138

23 libdyld.dylib 0x02f45a21 start + 1

24 ??? 0x00000001 0x0 + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)



_____________________________________


libsystem_kernel.dylib`__pthread_kill:

0x3289690 <+0>: movl $0x80148, %eax

0x3289695 <+5>: calll 0x328b4d8 ; _sysenter_trap

-> 0x328969a <+10>: jae 0x32896aa ; <+26> (sigabrt)

0x328969c <+12>: calll 0x32896a1 ; <+17>

0x32896a1 <+17>: popl %edx

0x32896a2 <+18>: movl 0x697f(%edx), %edx

0x32896a8 <+24>: jmpl *%edx

0x32896aa <+26>: retl

0x32896ab <+27>: nop



_______________________________________


UIKit`UIApplicationMain:

0xdc32ef <+0>: pushl %ebp

0xdc32f0 <+1>: movl %esp, %ebp

0xdc32f2 <+3>: pushl %ebx

0xdc32f3 <+4>: pushl %edi

0xdc32f4 <+5>: pushl %esi

0xdc32f5 <+6>: subl $0x1c, %esp

0xdc32f8 <+9>: calll 0xdc32fd ; <+14>

0xdc32fd <+14>: popl %ebx

0xdc32fe <+15>: movl 0x14(%ebp), %esi

0xdc3301 <+18>: movl 0x10(%ebp), %eax

0xdc3304 <+21>: movl %eax, (%esp)

0xdc3307 <+24>: calll 0x18fec72 ; symbol stub for: objc_retain

0xdc330c <+29>: movl %eax, -0x10(%ebp)

0xdc330f <+32>: movl %esi, (%esp)

0xdc3312 <+35>: calll 0x18fec72 ; symbol stub for: objc_retain

0xdc3317 <+40>: movl %eax, %edi

0xdc3319 <+42>: movl 0xd1ed2f(%ebx), %esi

0xdc331f <+48>: movl (%esi), %eax

0xdc3321 <+50>: testl %eax, %eax

0xdc3323 <+52>: je 0xdc3356 ; <+103>

0xdc3325 <+54>: cmpl $0x20100, %eax

0xdc332a <+59>: jb 0xdc3362 ; <+115>

0xdc332c <+61>: calll 0x18febc4 ; symbol stub for: objc_autoreleasePoolPush

0xdc3331 <+66>: movl %eax, -0x14(%ebp)

0xdc3334 <+69>: movl %edi, 0x4(%esp)

0xdc3338 <+73>: movl -0x10(%ebp), %esi

0xdc333b <+76>: movl %esi, (%esp)

0xdc333e <+79>: movl 0x8(%ebp), %ecx

0xdc3341 <+82>: movl 0xc(%ebp), %edx

0xdc3344 <+85>: calll 0xdc33c8 ; _UIApplicationMainPreparations

0xdc3349 <+90>: movl -0x14(%ebp), %eax

0xdc334c <+93>: movl %eax, (%esp)

0xdc334f <+96>: calll 0x18febbe ; symbol stub for: objc_autoreleasePoolPop

0xdc3354 <+101>: jmp 0xdc3377 ; <+136>

0xdc3356 <+103>: cmpl $0xffffffff, 0xd5b287(%ebx)

0xdc3360 <+113>: jne 0xdc33a9 ; <+186>

0xdc3362 <+115>: movl %edi, 0x4(%esp)

0xdc3366 <+119>: movl -0x10(%ebp), %esi

0xdc3369 <+122>: movl %esi, (%esp)

0xdc336c <+125>: movl 0x8(%ebp), %ecx

0xdc336f <+128>: movl 0xc(%ebp), %edx

0xdc3372 <+131>: calll 0xdc33c8 ; _UIApplicationMainPreparations

0xdc3377 <+136>: movl 0xd5b153(%ebx), %eax

0xdc337d <+142>: movl 0xd212d3(%ebx), %ecx

0xdc3383 <+148>: movl %ecx, 0x4(%esp)

0xdc3387 <+152>: movl %eax, (%esp)

0xdc338a <+155>: calll 0x18fec48 ; symbol stub for: objc_msgSend

0xdc338f <+160>: movl %edi, (%esp) (sigabrt)

0xdc3392 <+163>: calll 0x18fec6c ; symbol stub for: objc_release

0xdc3397 <+168>: movl %esi, (%esp)

0xdc339a <+171>: calll 0x18fec6c ; symbol stub for: objc_release

0xdc339f <+176>: xorl %eax, %eax

0xdc33a1 <+178>: addl $0x1c, %esp

0xdc33a4 <+181>: popl %esi

0xdc33a5 <+182>: popl %edi

0xdc33a6 <+183>: popl %ebx

0xdc33a7 <+184>: popl %ebp

0xdc33a8 <+185>: retl

0xdc33a9 <+186>: leal 0xd5f803(%ebx), %eax

0xdc33af <+192>: movl %eax, 0x4(%esp)

0xdc33b3 <+196>: leal 0xd5b287(%ebx), %eax

0xdc33b9 <+202>: movl %eax, (%esp)

0xdc33bc <+205>: calll 0x18ff3ec ; symbol stub for: dispatch_once

0xdc33c1 <+210>: movl (%esi), %eax

0xdc33c3 <+212>: jmp 0xdc3325 ; <+54>



_____________________________________________


libdyld.dylib`start:

0x2f45a20 <+0>: nop

0x2f45a21 <+1>: movl %eax, (%esp) (sigabrt)

0x2f45a24 <+4>: calll 0x2f45a48 ; symbol stub for: exit

0x2f45a29 <+9>: hlt

__________________________

Is that the write Information?

That looks like a crash log, not console output. Here's how to find the information I'm looking for:

•Open the debugger console at the bottom of the Xcode window (Cmd-Shift-Y)

•At the toolbar at the very bottom of the debugger area, look at the group of buttons along the right edge. Make sure that the button that's farthest to the right is highlighted—you should see a blank area that shows status messages, etc. as the app runs.

•Now build and run your app. When it hits the error, if the current line of code is highlighted in green, hit Continue until it turns red. Once it's red, hit the Stop button.

•In the log view, you should see a bunch of messages in a format kind of like this:

2015-08-19 16:29:48.492 AppName[11467:1261547] Message Text

Copy the contents of the log and paste it here.


What you pasted earlier is actually a snapshot of the current low-level system state; it's useful for some debugging tasks but not this one.

Can you show me on this picture were is the button what you mean.


Thanks


Can we send no pictures here?

It seems that everyone's having trouble with getting pictures to post. Which button can't you find?

...At the toolbar at the very bottom of the debugger area, look at the group of buttons along the right edge. Make sure that the button that's farthest to the right is highlighted—you should see a blank area that shows status messages, etc. as the app runs.


This Button that you described.

Since the earlier description doesn't make sense to you, have a look at the first screenshot of the Xcode window on this page: https://developer.apple.com/library/mac/documentation/ToolsLanguages/Conceptual/Xcode_Overview/index.html#//apple_ref/doc/uid/TP40010215


The screenshot shows both panes of the debugger area—we're interested in the one on the right. Look for the blank white area with (lldb) appearing in blue. That's the debugger console, where you can manually control LLDB and view any target or debugger output. If it's not open when you open the debugger area, click the button in the lower-right corner. It's two spaces to the right of the trash-can icon in the screenshot.

Okay and then?


I have send you the area with the blue lldb.

Or what you mean?

how do i fix the sigabrt error?
 
 
Q