Reputation: 3
Im new to iOS programming. I tried to make known HelloWorld application but the application does not work.
part of the
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
Thread 1: Signal SIGABRT error.
2013-10-28 19:52:07.872 MerhabaDunya[2341:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/bb/Library/Application Support/iPhone Simulator/7.0.3/Applications/32CBEFAF-FFFB-4550-990A-6A33B02CF7D6/MerhabaDunya.app> (loaded)' with name 'ViewController''
*** First throw call stack:
(
0 CoreFoundation 0x017395e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014bc8b6 objc_exception_throw + 44
2 CoreFoundation 0x017393bb +[NSException raise:format:] + 139
3 UIKit 0x004cb39c -[UINib instantiateWithOwner:options:] + 951
4 UIKit 0x0033d605 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
5 UIKit 0x0033ddad -[UIViewController loadView] + 302
6 UIKit 0x0033e0ae -[UIViewController loadViewIfRequired] + 78
7 UIKit 0x0033e5b4 -[UIViewController view] + 35
8 UIKit 0x002669fd -[UIWindow addRootViewControllerViewIfPossible] + 66
9 UIKit 0x00266d97 -[UIWindow _setHidden:forced:] + 312
10 UIKit 0x0026702d -[UIWindow _orderFrontWithoutMakingKey] + 49
11 UIKit 0x0027189a -[UIWindow makeKeyAndVisible] + 65
12 MerhabaDunya 0x00002cdb -[AppDelegate application:didFinishLaunchingWithOptions:] + 683
13 UIKit 0x00224355 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
14 UIKit 0x00224b95 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
15 UIKit 0x002293a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
16 UIKit 0x0023d87c -[UIApplication handleEvent:withNewEvent:] + 3447
17 UIKit 0x0023dde9 -[UIApplication sendEvent:] + 85
18 UIKit 0x0022b025 _UIApplicationHandleEvent + 736
19 GraphicsServices 0x036e02f6 _PurpleEventCallback + 776
20 GraphicsServices 0x036dfe01 PurpleEventCallback + 46
21 CoreFoundation 0x016b4d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
22 CoreFoundation 0x016b4a9b __CFRunLoopDoSource1 + 523
23 CoreFoundation 0x016df77c __CFRunLoopRun + 2156
24 CoreFoundation 0x016deac3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x016de8db CFRunLoopRunInMode + 123
26 UIKit 0x00228add -[UIApplication _run] + 840
27 UIKit 0x0022ad3b UIApplicationMain + 1225
28 MerhabaDunya 0x00002f2d main + 141
29 libdyld.dylib 0x01d7770d start + 1
30 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
appdelegate.h
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
appdeledage.m
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
@synthesize window=_window;
@synthesize viewController=_viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController=[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController=self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
ViewController.m #import "ViewController.h"
@implementation ViewController
@synthesize etiket;
@synthesize tus;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)basildi:(id)sender {
[etiket setText:@"Hello"];
}
@end
Upvotes: 0
Views: 975
Reputation: 24481
From the stack trace, it appears that you are trying to instantiate a UIViewController
with the method -initWithNibName:bundle:
but with a non-existent or nil nib name.
Make sure that the nib name parameter that you are passing in does exist i.e. a file exists with the name ExampleViewController.xib
, or the parameter is not nil.
Edit---
Now that you've posted your code, I can clarify further. The file ViewController.xib
does not exist, and needs to be created. Alternatively, you may have a typo. Compare the string to the xib
, if any, in your main bundle.
Edit---
Now that you mentioned storyboards, you should just return YES in your -...didFinishLaunching...
method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}
Upvotes: 2
Reputation: 131398
If you're using storyboards then you should not be calling initWithNibName. It sounds like you're trying to mix code from an XIB-based app into a storyboard based app. That won't work.
Rip all that code out of your didFinishLaunchingWithOptions method. Simply return YES.
Upvotes: 0