Objective C, Thread 1 Program Received Signal SIGABRT [duplicate] - ios

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
I am trying to compile and run a simple tutorial for an Objective C app using Interface Builder. I am using Xcode 4.0.2 and simulating on iOS (iPhone) 4.3
http://www.switchonthecode.com/tutorials/creating-your-first-iphone-application-with-interface-builder
When I build the project, it builds alright but once the app tries to run it crashes with:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, #"SimpleUIAppDelegate");
[pool release];
return retVal;
}
I get the error on line 4: int retVal = UI... Thread 1: Program Received Signal "SIGABRT".
If the other files of this project need to be posted for clarity, I can do that.
Thanks!
Edit:
SimpleUIViewController.h:
#import <UIKit/UIKit.h>
#interface SimpleUIViewController : UIViewController <UITextFieldDelegate> {
UITextField *textInput;
UILabel *label;
NSString *name;
}
#property (nonatomic, retain) IBOutlet UITextField *textInput;
#property (nonatomic, retain) IBOutlet UILabel *label;
#property (nonatomic, copy) NSString *name;
- (IBAction)changeGreeting:(id)sender;
#end
SimpleUIViewController.m:
#import "SimpleUIViewController.h"
#implementation SimpleUIViewController
#synthesize textInput;
#synthesize label;
#synthesize name;
- (IBAction)changeGreeting:(id)sender {
self.name = textInput.text;
NSString *nameString = name;
if([nameString length] == 0) {
nameString = #"Inigo Montoya";
}
NSString *greeting = [[NSString alloc]
initWithFormat:#"Hello, my name is %#!", nameString];
label.text = greeting;
[greeting release];
}
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if(theTextField == textInput) {
[textInput resignFirstResponder];
}
return YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[textInput release];
[label release];
[name release];
[super dealloc];
}
#end
Error message:
This GDB was configured as "x86_64-apple-darwin".Attaching to process 2668.
2011-06-09 11:20:21.662 InterfaceBuilder[2668:207] Unknown class InterfaceBuilderAppDelegate_iPhone in Interface Builder file.
2011-06-09 11:20:21.666 InterfaceBuilder[2668:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x4b1a900> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textInput.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dc24e1 -[NSException raise] + 17
3 Foundation 0x00794677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007945e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0021030c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d388cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020ed23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x00210ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0001617a -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x00016cf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
11 UIKit 0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x00019abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001ef2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ffb992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
18 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
20 UIKit 0x000167d2 -[UIApplication _run] + 623
21 UIKit 0x00022c93 UIApplicationMain + 1160
22 InterfaceBuilder 0x000027ff main + 127
23 InterfaceBuilder 0x00002775 start + 53
24 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)
Im new to obj-c, and have absolutely no idea what I'm looking at in regards to that error message. Any help?

You have an error in your NIB/XIB file.
It looks like you have previously attached an IBOutlet (textInput) and now the connection is broken. You should double check all connections in Interface Builder.

It's likely that you have set the type of 'File's Owner' incorrectly to UIViewController in your SimpleUIViewController's xib. Please set it to SimpleUIViewController in identity inspector pane.

Now I see it! Your crash report says:
Unknown class InterfaceBuilderAppDelegate_iPhone
So, it seems that you set your App Delegate in IB to this class, but this class is not available in your project. Check this. Either you misspelled the class name or you should add the relevant class to your project.
Highly likely, your text field is connected to this app delegate.
Have you connected your text field in Interface Builder to the SimpleUIViewController outlet?
Since it seems from the tutorial that you are not using MainWindow.xib, I would say that your project is missing running the proper delegate. Try making this change in your main:
int retVal = UIApplicationMain(argc, argv, nil, #"SimpleUIAppDelegate");
If my hypothesis is right, that should move your forward.

To fix it, load the XIB in 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.
NSLayoutConstraint SIGABRT on iPad

thread 1 program recived singal sigabrt
some times NSString value is goes to nill!
it may cause this while initialization of your application!

Related

Current user location for iOS 8 - App won't launch

I have been working on a simple app to get the users current location using the Core Location framework from Apple in Xcode and when i run the app i get an error. Can someone please tell me what i did wrong thank you in advance. I have this code here in the Implementation file.
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController { CLLocationManager *locationManager;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
locationManager = [[CLLocationManager alloc] init];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)getCurrentLocation:(id)sender {
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
#pragma mark - CLLocationManagerDelegate
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(#"didUpdateToLocation: %#", newLocation);
CLLocation *currentLocation = newLocation;
if (currentLocation != nil) {
_longitudeLabel.text = [NSString stringWithFormat:#"%.8f", currentLocation.coordinate.longitude];
_latitudeLabel.text = [NSString stringWithFormat:#"%.8f", currentLocation.coordinate.latitude];
}
}
#end
This is the Header file...
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#interface ViewController : UIViewController <CLLocationManagerDelegate>
#property (strong, nonatomic) IBOutlet UILabel *latitudeLabel;
#property (strong, nonatomic) IBOutlet UILabel *longitudeLabel;
#property (strong, nonatomic) IBOutlet UILabel *addressLabel;
- (IBAction)getCurrentLocation:(id)sender;
#end
And this is the output of the crash...
2016-01-11 11:53:58.346 current location practice[1367:32081] *** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<ViewController 0x7ff240d80cb0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key getCurrentLocation.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ee29f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e8a3deb objc_exception_throw + 48
2 CoreFoundation 0x000000010ee29b89 -[NSException raise] + 9
3 Foundation 0x000000010e470a6b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x000000010f36104c -[UIViewController setValue:forKey:] + 88
5 UIKit 0x000000010f58ea71 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010ed6aa80 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x000000010f58d454 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x000000010f367c16 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x000000010f368542 -[UIViewController loadView] + 178
10 UIKit 0x000000010f3688a0 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x000000010f369013 -[UIViewController view] + 27
12 UIKit 0x000000010f24251c -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x000000010f242c05 -[UIWindow _setHidden:forced:] + 282
14 UIKit 0x000000010f2544a5 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010f1ce396 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16 UIKit 0x000000010f1d49c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750
17 UIKit 0x000000010f1d1ba3 -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x000000011219f784 -[FBSSerialQueue _performNext] + 192
19 FrontBoardServices 0x000000011219faf2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
20 CoreFoundation 0x000000010ed56011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x000000010ed4bf3c __CFRunLoopDoSources0 + 556
22 CoreFoundation 0x000000010ed4b3f3 __CFRunLoopRun + 867
23 CoreFoundation 0x000000010ed4ae08 CFRunLoopRunSpecific + 488
24 UIKit 0x000000010f1d14f5 -[UIApplication _run] + 402
25 UIKit 0x000000010f1d630d UIApplicationMain + 171
26 current location practice 0x000000010e3224bf main + 111
27 libdyld.dylib 0x0000000111d5892d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Can someone please tell me what i did wrong and what i can do to fix it? Thank you.
As per below errors:
6 CoreFoundation 0x000000010ed6aa80 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x000000010f58d454 -[UINib instantiateWithOwner:options:] + 1864
It seems, your IBAction is not bounded with getCurrentLocation method, or is added wrongly.
It's right at the top of the error message:
2016-01-11 11:53:58.346 current location practice[1367:32081] *** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<ViewController 0x7ff240d80cb0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key getCurrentLocation.'
It's telling you that you're trying to use a key called getCurrentLocation on your class ViewController, but the class doesn't have that key. Most likely this means something's wrong with your storyboard. One scenario that would cause this would be connecting a button to an action named getCurrentLocation, but then deleting that method and not updating the storyboard.

-[announceViewController xCJSONDidBeginLoadingJSONData]: unrecognized selector sent to instance 0x7faa01504d50

I have got this problem cause the app crash:
The probelm start when the app launch when I add the new view to handle 2 uiimages with two buttons
gameApp[5963:1756169] -[announceViewController xCJSONDidBeginLoadingJSONData]: unrecognized selector sent to instance 0x7faa01504d50
2014-11-03 09:16:01.386 gameApp[5963:1756169] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[announceViewController xCJSONDidBeginLoadingJSONData]: unrecognized selector sent to instance 0x7faa01504d50'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107fe9f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107c82bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000107ff104d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000107f4908f ___forwarding___ + 495
4 CoreFoundation 0x0000000107f48e18 _CF_forwarding_prep_0 + 120
5 gameApp 0x0000000103d75462 -[XCJSONLoader startLoadFrom:] + 66
6 gameApp 0x0000000103d75de3 -[announceViewController setUpJSON] + 259
7 gameApp 0x0000000103d75c99 -[announceViewController viewDidLoad] + 73
8 UIKit 0x0000000106402a90 -[UIViewController loadViewIfRequired] + 738
9 UIKit 0x0000000106402c8e -[UIViewController view] + 27
10 UIKit 0x0000000106321ca9 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x0000000106322041 -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010632e72c -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x00000001062d9061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628
14 UIKit 0x00000001062dbd2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
15 UIKit 0x00000001062dabf2 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x000000010dfa62a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
17 CoreFoundation 0x0000000107f1f53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x0000000107f15285 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x0000000107f15045 __CFRunLoopRun + 2389
20 CoreFoundation 0x0000000107f14486 CFRunLoopRunSpecific + 470
21 UIKit 0x00000001062da669 -[UIApplication _run] + 413
22 UIKit 0x00000001062dd420 UIApplicationMain + 1282
23 gameApp 0x0000000103d78913 main + 115
24 libdyld.dylib 0x0000000108c17145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
and here is the h file :
#import <UIKit/UIKit.h>
#import "XCJSONLoader.h"
#interface announceViewController : UIViewController <XCJSONLoaderDelegate>
#property (strong,nonatomic) XCJSONLoader *jsonLoader;
#property (weak, nonatomic) IBOutlet UIImageView *anImageView;
#property (weak, nonatomic) IBOutlet UIImageView *spImageView;
- (IBAction)anButton:(id)sender;
- (IBAction)spButton:(id)sender;
#end
and this is the .m file
#interface announceViewController () {
NSMutableArray *JSONData;
}
#end
#implementation announceViewController
#synthesize jsonLoader,anImageView,spImageView;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setUpJSON];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (void) setUpJSON
{
jsonLoader = [[XCJSONLoader alloc] init];
[jsonLoader setDelegate:self];
NSString *JSONLink = [NSString stringWithFormat:#"http://ya-techno.com/gameApp/anData.php"]; // Your URL goes here
[jsonLoader startLoadFrom:JSONLink];
}
- (void)xCJSONDidFinishLoadingJSONData
{
JSONData = [jsonLoader getJSONData];
}
- (IBAction)anButton:(id)sender {
JSONData = [jsonLoader getJSONData];
NSString *anButtonString = [NSString stringWithFormat:#"%#", [[JSONData objectAtIndex:0] objectForKey:#"anButton"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:anButtonString]];
}
- (IBAction)spButton:(id)sender {
}
#end
I could not find the problem for this one. Any help
Read the error. It says you haven't implemented the xCJSONDidBeginLoadingJSONData method. And you haven't. You do have the xCJSONDidFinishLoadingJSONData method but not the xCJSONDidBeginLoadingJSONData method.
Add the xCJSONDidBeginLoadingJSONData method to your announceViewController class to fix the problem.
BTW - standard naming conventions state that class names should being with uppercase letters. Method and variable names begin with lowercase letters.

iOS this class is not key value coding-compliant for the key label

So I'm new to iOS programming and I've run into a problem.
I created a new view controller, and clicked the checkmark to auto make a .xib file for it. In the xib file I put a label, that I want to fade in. So I tried linking it to my custom view controller, and keep crashing with 'this class is not key value coding-compliant for the key login1'. Login1 being the name of the UILabel I imported. Here's the header file for RootView:
#interface RootViewController : UIViewController {
PlayerStatViewController *playerStatViewController;
NSString *viewName;
}
#property (weak, nonatomic) IBOutlet UILabel *login1;
#property (nonatomic, retain) PlayerStatViewController *playerStatViewController;
#property (nonatomic, retain) NSString *viewName;
-(IBAction)switchPage:(id)sender:(NSString *)toSwitch;
-(void) animateButton;
#end
And the .m file:
#import "RootViewController.h"
#import "FileUtils.h"
#interface RootViewController ()
#end
#implementation RootViewController
#synthesize playerStatViewController;
#synthesize viewName;
#synthesize login1;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
self.viewName = #"Boot";
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString* fpath = [NSString stringWithFormat:#"%#%#", getDefPath(), #"/config.txt"];
self.login1.text = loadfile(#"serverName", fpath);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
-(IBAction)switchPage:(id)sender :(NSString *)toSwitch {
if([toSwitch isEqualToString:(#"PlayerStat")]) {
if(self.playerStatViewController == nil) {
PlayerStatViewController *playerStatView = [[PlayerStatViewController alloc]
initWithNibName:(#"PlayerStat") bundle:[NSBundle mainBundle]];
self.playerStatViewController = playerStatView;
}
[self.navigationController pushViewController:self.playerStatViewController animated:YES];
}else if([toSwitch isEqualToString:(#"Boot")]) {
[self.navigationController pushViewController:self animated:YES];
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self performSelector:#selector(animateButton) withObject:nil afterDelay:0.1f];
}
- (void)animateButton {
self.login1.alpha = 0;
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseIn
animations:^{ self.login1.alpha = 1;}
completion:nil];
}
#end
How I load the Xib (if it matters):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *viewController = [[RootViewController alloc] initWithNibName:#"RootViewController" bundle:nil];
[self.window setRootViewController:viewController];
[window makeKeyAndVisible];
return YES;
}
Project being built for iPhone only.
In the Xib, yes the custom view controller is set as the file owner. There is no mispointing values (exclamation points in inspection manager).
edit:
crash log:
2014-08-06 06:02:12.887 TrinityApi[5761:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x8c781d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key login1.'
*** First throw call stack:
(
0 CoreFoundation 0x017ee1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0156d8e5 objc_exception_throw + 44
2 CoreFoundation 0x0187dfe1 -[NSException raise] + 17
3 Foundation 0x0122dd9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x0119a1d7 _NSSetUsingKeyValueSetter + 88
5 Foundation 0x01199731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x011fbb0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004e41f4 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x0157f7de -[NSObject performSelector:] + 62
9 CoreFoundation 0x017e976a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004e2d4d -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x004e4ada -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
12 UIKit 0x0022d61b -[UIApplication _loadMainNibFileNamed:bundle:] + 58
13 UIKit 0x0022d949 -[UIApplication _loadMainInterfaceFile] + 245
14 UIKit 0x0022c54e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
15 UIKit 0x00240f92 -[UIApplication handleEvent:withNewEvent:] + 3517
16 UIKit 0x00241555 -[UIApplication sendEvent:] + 85
17 UIKit 0x0022e250 _UIApplicationHandleEvent + 683
18 GraphicsServices 0x037e3f02 _PurpleEventCallback + 776
19 GraphicsServices 0x037e3a0d PurpleEventCallback + 46
20 CoreFoundation 0x01769ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
21 CoreFoundation 0x017699db __CFRunLoopDoSource1 + 523
22 CoreFoundation 0x0179468c __CFRunLoopRun + 2156
23 CoreFoundation 0x017939d3 CFRunLoopRunSpecific + 467
24 CoreFoundation 0x017937eb CFRunLoopRunInMode + 123
25 UIKit 0x0022bd9c -[UIApplication _run] + 840
26 UIKit 0x0022df9b UIApplicationMain + 1225
27 TrinityApi 0x00002a9d main + 141
28 libdyld.dylib 0x01e35701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
EDIT: Just randomly started to work
"class is not key value coding-compliant " means You had assigned an outlet to our label at first and had connected it in our xib, but then you have deleted the outlet and the xib is still containing a reference to the outlet which is no longer present, You need to remove this reference from your xib.
Goto your XIB file and right click on Files Owner, you may find a label with a yellow mark on it, just remove the outlet to which its connected to, clean and run your program once again

UIWebView doesn't work anymore

I re-edit my question, it's for about two weeks that i set up my WebView in my application, everything was going well working together. Yesterday i wanted to just see if the webView is still working even if i didn't change any of the class's code, and boom SIGABRT. I'm on this bug since yesterday and don't understand why it still give my a SIGABRT.I did as advised some changes but still nothing works yet. If someone with advanced skills in objective c can help me please i'am going crazy, here is the log message (i can show all my code if needed, and please feel free to edit an answer so i can rate the good answer in order to help people after me):
here is my code :
- (void)showWebView;
{
//here i call my webview in my RootViewController
ViewController *WebViewVC = [[ViewController alloc] init];
[[self navigationController] pushViewController:WebViewVC animated:YES];
[WebViewVC pushIt];
}
//here is my WebViewController.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#interface ViewController : UIViewController <UIWebViewDelegate>
{
IBOutlet UIWebView *myWebView;
}
#property (nonatomic, retain) IBOutlet UIWebView *myWebView;
-(void)XButton;
-(void)pushIt;
#end
//here is my WebViewController.m
-(void)pushIt;
{
navigation control
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = nil;
self.title = #"*****";
myWebView = [[UIWebView alloc] initWithFrame:self.view.frame];
[self.view addSubview:myWebView];
[self XButton];
[self WebViewBrowserBackButton];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *defaults = [prefs stringForKey:#"myKey"];
NSString *defaults2 = [prefs stringForKey:#"mySecondKey"];
NSString *username = defaults;
NSString *password = defaults2;
NSURL* url = [NSURL URLWithString:#"**************"];
NSString* body = [NSString stringWithFormat:#"************", username, password];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];
request.HTTPMethod = #"POST";
request.HTTPBody = [body dataUsingEncoding:NSStringEncodingConversionAllowLossy];
[myWebView loadRequest:request];
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MyWebViewController" nib but the view outlet was not set.'
*** First throw call stack:
(
0 CoreFoundation 0x017e15e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015648b6 objc_exception_throw + 44
2 CoreFoundation 0x017e13bb +[NSException raise:format:] + 139
3 UIKit 0x005fd6e6 -[UIViewController _loadViewFromNibNamed:bundle:] + 505
4 UIKit 0x005fddad -[UIViewController loadView] + 302
5 UIKit 0x005fe0ae -[UIViewController loadViewIfRequired] + 78
6 UIKit 0x005fe5b4 -[UIViewController view] + 35
7 LockScreen 0x00011596 -[MyWebViewController pushIt] + 246
8 LockScreen 0x00003c0a -[RootViewController showWebView] + 202
9 libobjc.A.dylib 0x015767d2 -[NSObject performSelector:] + 62
10 LockScreen 0x00007f02 -[LCYDataBackedTableView tableView:didSelectRowAtIndexPath:] + 130
11 UIKit 0x005cc7b1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
12 UIKit 0x005cc924 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
13 UIKit 0x005d0908 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
14 UIKit 0x00507183 ___afterCACommitHandler_block_invoke + 15
15 UIKit 0x0050712e _applyBlockToCFArrayCopiedToStack + 403
16 UIKit 0x00506f5a _afterCACommitHandler + 532
17 CoreFoundation 0x017a94ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
18 CoreFoundation 0x017a941f __CFRunLoopDoObservers + 399
19 CoreFoundation 0x01787344 __CFRunLoopRun + 1076
20 CoreFoundation 0x01786ac3 CFRunLoopRunSpecific + 467
21 CoreFoundation 0x017868db CFRunLoopRunInMode + 123
22 GraphicsServices 0x02a659e2 GSEventRunModal + 192
23 GraphicsServices 0x02a65809 GSEventRun + 104
24 UIKit 0x004ead3b UIApplicationMain + 1225
25 LockScreen 0x0000297d main + 125
26 libdyld.dylib 0x0208970d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Connect the view property of WebViewController from nib file to File's Owner's view object.
The exception trace clearly shows that your view in nib is not connected.

Thread 1: signal SIGABRT error in main

Got this error message in the main function. Am new to debugging this kind of error in Xcode 5, so would appreciate your suggestions about how to approach this kind of error.
Thanks in advance.
Here is the code:
Main:
#import <UIKit/UIKit.h>
#import "BullsEyeAppDelegate.h"
int main(int argc, char * argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([BullsEyeAppDelegate class])); //Thread 1: signal SIGABRT
}
}
BullsEyeViewController.h
#import <UIKit/UIKit.h>
#interface BullsEyeViewController : UIViewController
#property (nonatomic, weak) IBOutlet UISlider *slider;
#property (nonatomic, weak) IBOutlet UILabel *targetLabel;
#property (nonatomic, weak) IBOutlet UILabel *scoreLabel;
#property (nonatomic, weak) IBOutlet UILabel *roundLabel;
-(IBAction)showAlert;
-(IBAction)sliderMoved:(UISlider *)slider;
#end
BullsEyeViewController.m
#import "BullsEyeViewController.h"
#interface BullsEyeViewController ()
#end
#implementation BullsEyeViewController
{
int _currentValue;
int _targetValue;
int _score;
int _round;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self startNewRound];
[self updateLabels];
}
-(void)startNewRound
{
_targetValue = 1 + arc4random_uniform(100);
_currentValue = 50;
self.slider.value = _currentValue;
[self updateLabels];
}
-(void)updateLabels
{
self.targetLabel.text = [NSString stringWithFormat:#"%d", _targetValue];
// Convert the int into a string so that it will fit in the label as an outlet
self.scoreLabel.text = [NSString stringWithFormat:#"%d", _score];
self.roundLabel.text = [NSString stringWithFormat:#"%d", _round];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(IBAction)showAlert
{
int difference = abs(_currentValue - _targetValue);
int points = 100 - difference;
_score += points;
NSString *message = [NSString stringWithFormat:#"You scored %d points", points];
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:#"Hello World"
message:message
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[alertView show];
[self startNewRound];
[self updateLabels];
}
-(IBAction)sliderMoved:(UISlider *)slider
{
_currentValue = lroundf(slider.value);
}
#end
Error Trace:
2013-11-19 19:59:12.299 BullsEye[13764:70b] -[UILabel intValue]: unrecognized selector sent to instance 0x8a7ef20
2013-11-19 19:59:12.351 BullsEye[13764:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel intValue]: unrecognized selector sent to instance 0x8a7ef20'
*** First throw call stack:
(
0 CoreFoundation 0x0173a5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014bd8b6 objc_exception_throw + 44
2 CoreFoundation 0x017d7903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0172a90b ___forwarding___ + 1019
4 CoreFoundation 0x0172a4ee _CF_forwarding_prep_0 + 14
5 Foundation 0x0117d737 _NSSetIntValueForKeyInIvar + 46
6 Foundation 0x010eada3 _NSSetUsingKeyValueSetter + 256
7 Foundation 0x010ea253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
8 Foundation 0x0114c70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
9 UIKit 0x004cda15 -[UIRuntimeOutletConnection connect] + 106
10 libobjc.A.dylib 0x014cf7d2 -[NSObject performSelector:] + 62
11 CoreFoundation 0x01735b6a -[NSArray makeObjectsPerformSelector:] + 314
12 UIKit 0x004cc56e -[UINib instantiateWithOwner:options:] + 1417
13 UIKit 0x0033e605 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
14 UIKit 0x0033edad -[UIViewController loadView] + 302
15 UIKit 0x0033f0ae -[UIViewController loadViewIfRequired] + 78
16 UIKit 0x0033f5b4 -[UIViewController view] + 35
17 UIKit 0x002679fd -[UIWindow addRootViewControllerViewIfPossible] + 66
18 UIKit 0x00267d97 -[UIWindow _setHidden:forced:] + 312
19 UIKit 0x0026802d -[UIWindow _orderFrontWithoutMakingKey] + 49
20 UIKit 0x0027289a -[UIWindow makeKeyAndVisible] + 65
21 UIKit 0x00225cd0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1851
22 UIKit 0x0022a3a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
23 UIKit 0x0023e87c -[UIApplication handleEvent:withNewEvent:] + 3447
24 UIKit 0x0023ede9 -[UIApplication sendEvent:] + 85
25 UIKit 0x0022c025 _UIApplicationHandleEvent + 736
26 GraphicsServices 0x036e12f6 _PurpleEventCallback + 776
27 GraphicsServices 0x036e0e01 PurpleEventCallback + 46
28 CoreFoundation 0x016b5d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
29 CoreFoundation 0x016b5a9b __CFRunLoopDoSource1 + 523
30 CoreFoundation 0x016e077c __CFRunLoopRun + 2156
31 CoreFoundation 0x016dfac3 CFRunLoopRunSpecific + 467
32 CoreFoundation 0x016df8db CFRunLoopRunInMode + 123
33 UIKit 0x00229add -[UIApplication _run] + 840
34 UIKit 0x0022bd3b UIApplicationMain + 1225
35 BullsEye 0x0000219d main + 141
36 libdyld.dylib 0x01d7870d start + 1
37 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
These 2 lines reveal your error in the error trace:
2013-11-19 19:59:12.299 BullsEye[13764:70b] -[UILabel intValue]: unrecognized selector sent to instance 0x8a7ef20
2013-11-19 19:59:12.351 BullsEye[13764:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel intValue]: unrecognized selector sent to instance 0x8a7ef20'
It appears you error isn't caused by the code you posted but where ever you have:
[UILabel intValue];
Wherever you are using the above code, you are trying to get the integer value of a UILabel, when you should be trying to get the integer value of the text property of the UILabel.
So, assuming the name of your label is "myLabel:"
[myLabel.text intValue];

Resources