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.

Sorrry, that was wrong.

Now I write there Main, without storyboard.


And I become this error:


2015-08-22 10:37:15.331 Kapitel2[1352:62128] [+] <ViewController: 0x79c22120>.writeLog:

(lldb)

What you mean:


Main.storyboard or Main or nothing?

If your storyboard is Main.storyboard, then you should write "Main" in the info.


And about that "writeLog" thing, is that actually causing the app to malfunction or are you just seeing it in the debugger area? Other kinds of status/info messages get printed there; it's not all errors.

Okay, so this is in the Debug area:


2015-08-22 12:56:05.375 Kapitel2[1418:73005] [+] <ViewController: 0x7be72f70>.writeLog:

(lldb)

And this is on the left side:


self

ViewController *

0x7be72f70

0x7be72f70

UIViewController

UIViewController

UIResponder

UIResponder

NSObject

NSObject

isa

Class

ViewController

0x00074bc8

_textView

UITextView *

0x7c1c9c00

0x7c1c9c00

UIScrollView

UIScrollView

_private

id

0x0

0x00000000

_textStorage

NSConcreteTextStorage *

0x7da878b0

0x7da878b0

_textContainer

NSTextContainer *

0x7da862c0

0x7da862c0

_layoutManager

NSLayoutManager *

0x7da87d90

0x7da87d90

_containerView

_UITextContainerView *

0x7d887350

0x7d887350

_inputDelegate

id

0x0

0x00000000

_tokenizer

id

0x0

0x00000000

_inputController

UITextInputController *

0x7da933a0

0x7da933a0

_interactionAssistant

UITextInteractionAssistant *

0x7bea3a40

0x7bea3a40

_textInputTraits

id

0x0

0x00000000

_autoscroll

id

0x0

0x00000000

_contentSizeUpdateSeqNo

int

2

2

_scrollTarget

id

0x0

0x00000000

_scrollPositionDontRecordCount

unsigned int

0

0

_scrollPosition

_UITextViewRestorableScrollPosition *

0x7da902c0

0x7da902c0

_offsetFromScrollPosition

float

0

0

_linkInteractionItem

id

0x0

0x00000000

_dataDetectorTypes

unsigned int

0

0

_preferredMaxLayoutWidth

float

0

0

_placeholderLabel

id

0x0

0x00000000

_inputAccessoryView

id

0x0

0x00000000

_streamingManager

id

0x0

0x00000000

_characterStreamingManager

id

0x0

0x00000000

_siriAnimationStyle

int

0

0

_siriParameters

id

0x0

0x00000000

_firstBaselineOffsetFromTop

float

0

0

_lastBaselineOffsetFromBottom

float

0

0

_clearsOnInsertion

char

'\0'

'\0'

_inputView

id

0x0

0x00000000

_model

Model *

nil

0x00000000

NSObject

NSObject

objects

NSMutableArray *

nil

status

NSString *

nil

name

NSString *

nil

creation

NSDate *

nil

inLogString

__NSCFConstantString *

@"viewDidLoad"

0x00074078

__NSCFString

__NSCFString

theFormatter

NSDateFormatter *

0x7d88aa70

0x7d88aa70

NSFormatter

NSFormatter

_attributes

__NSDictionaryM *

2 key/value pairs

0x7d886360

_formatter

__CFDateFormatter *

0x7bf92fe0

0x7bf92fe0

_counter

unsigned int

0

0

_lock

OS_dispatch_semaphore *

0x7d889020

0x7d889020

_cacheGeneration

int

2

2

The stuff on the left is the currently relevant variables. Try typing this into the area on the right, then let me know what you see:

po [NSThread callStackSymbols]

You mean this:


2015-08-22 13:33:34.040 Kapitel2[1461:81250] [+] <ViewController: 0x7a726d00>.writeLog:

(lldb)

Yes. Type that command right after the blue (lldb) prompt and post what prints out.

What shoud I write in the command?

po [NSThread callStackSymbols]


That will explain what's going on at the current instant.

Okay, here:


2015-08-22 14:44:08.059 Kapitel2[1527:98470] [+] <ViewController: 0x7b658d20>.writeLog:

(lldb) po [NSThread callStackSymbols]

<_NSCallStackArray 0x7c253c80>(

0 ??? 0x0b9488f3 0x0 + 194283763,

1 Kapitel2 0x000909f0 main + 0,

2 Kapitel2 0x0008ff62 -[ViewController viewDidLoad] + 178,

3 UIKit 0x00feadf8 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 44,

4 UIKit 0x00fef5c3 -[UIViewController loadViewIfRequired] + 950,

5 UIKit 0x00fef9e2 -[UIViewController view] + 35,

6 UIKit 0x00ea545c -[UIWindow addRootViewControllerViewIfPossible] + 69,

7 UIKit 0x00ea5b8d -[UIWindow _setHidden:forced:] + 324,

8 UIKit 0x00ea5f2d -[UIWindow _orderFrontWithoutMakingKey] + 49,

9 UIKit 0x00eb92f4 -[UIWindow makeKeyAndVisible] + 81,

10 UIKit 0x00e2a6b3 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4054,

11 UIKit 0x00e31929 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1976,

12 UIKit 0x00e54af6 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3142 + 68,

13 UIKit 0x00e2e6a6 -[UIApplication workspaceDidEndTransaction:] + 163,

14 FrontBoardServices 0x0360cccc __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71,

15 FrontBoardServices 0x0360c7a3 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54,

16 FrontBoardServices 0x0362a1cb -[FBSSerialQueue _performNext] + 184,

17 FrontBoardServices 0x0362a602 -[FBSSerialQueue _performNextFromRunLoopSource] + 52,

18 FrontBoardServices 0x036298fe FBSSerialQueueRunLoopSourceHandler + 33,

19 CoreFoundation 0x009bd7af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15,

20 CoreFoundation 0x009b343b __CFRunLoopDoSources0 + 523,

21 CoreFoundation 0x009b2858 __CFRunLoopRun + 1032,

22 CoreFoundation 0x009b2196 CFRunLoopRunSpecific + 470,

23 CoreFoundation 0x009b1fab CFRunLoopRunInMode + 123,

24 UIKit 0x00e2df8f -[UIApplication _run] + 540,

25 UIKit 0x00e33724 UIApplicationMain + 160,

26 Kapitel2 0x00090a7a main + 138,

27 libdyld.dylib 0x02fe0a21 start + 1,

28 ??? 0x00000001 0x0 + 1

)

(lldb)

Your custom view controller (the ViewController class) is doing something wrong in its -viewDidLoad method. Have you made sure that the view controller's view outlet is connected properly? That might be causing this newer issue…

I don't think so, here is the code from my viewcontrollers, can you find anything wrong?


v.m:


#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

[self.textView setText:@""];

[self writeLog:@"viewDidLoad"];

self.model = [[Model alloc] initWithName:@"LoremIpsum"];

[self writeLog:[NSString stringWithFormat:@"Model.name: %@", [self.model name]]];

/

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

/

}

- (void)writeLog:(NSString *)inLogString{

NSLog(@"[+] %@.%@", self, NSStringFromSelector(_cmd));

NSDateFormatter *theFormatter = [[NSDateFormatter alloc] init];


[theFormatter setDateFormat:@"HH:mm:ss.SS"];

[self.textView setText:[NSString stringWithFormat:@"%@\n%@ [+] %@", [self.textView text], [theFormatter stringFromDate:[NSDate date]],inLogString]];



} Here is the breakpoint

- (IBAction)updateCountOfDroids:(UIStepper *)sender {

int theValue = [sender value];


[self.model updateDroids:theValue];

[self writeLog:[NSString stringWithFormat: @"countOfObjects = %d", [self.model countOfObjects]]];

}

- (IBAction)listModel:(id)sender {

[self.model listDroids];

}

@end



v.h:


#import <UIKit/UIKit.h>

#import "Model.h"

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextView *textView;

@property (strong) Model *model;

@end

Are you sure it's malfunctioning? It doesn't look like anything is wrong—the stuff getting printed in the console is simply the result of your NSLog() call. I'm fascinated, though, by the main() function that appears to be called by -viewDidLoad; perhaps the compiler isn't handling the transition from -writeLog: back up to -viewDidLoad very well.

Hang on—I just thought of this. You made sure that you weren't causing the app to stop there, right? If there's a blue arrow symbol next to that line, drag it away from there to delete the user-defined breakpoint.

Hey great it works!!!

The Problem after the first solutuion for the error was the blue arrow symbol.


Thanks a lot for your great help.

how do i fix the sigabrt error?
 
 
Q