Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I lately have been using the Xcode 5 preview to develop for ios 7. Since I have in stalled the final version, my app hasn't been running. When the app begins to load, I get this...
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
This is my error message-
2013-09-21 16:30:33.117 App Name[6039:60b] -[AppDelegate window]: unrecognized selector sent to instance 0x15e70080
2013-09-21 16:30:33.128 App Name[6039:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate window]: unrecognized selector sent to instance 0x15e70080'
* First throw call stack:
(0x2d488e8b 0x377826c7 0x2d48c7b7 0x2d48af55 0x2d3d9e98 0x60c1d 0x2fc7f425 0x2fc7ee6b 0x2fc794b9 0x2fc13be7 0x2fc12edd 0x2fc78ca1 0x320f476d 0x320f4357 0x2d45377f 0x2d45371b 0x2d451ee7 0x2d3bc541 0x2d3bc323 0x2fc77f43 0x2fc731e5 0x74cd5 0x37c7bab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The error message -[AppDelegate window]: unrecognized selector sent to instance indicates that your appDelegate class is missing the required UIWindow *window property. Your appDelegate header file should look like this at a minimum:
#interface AnyNameAppDelegate : UIResponder <UIApplicationDelegate>
#property (strong, nonatomic) UIWindow *window;
#end
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
My problem it's when instance a SecondViewController in FirstViewController for assign a value on variable ID, the problem is I can not use Segue and NaviagtioController..
Maybe a solution use a Static variable?, How do it, or tell me a tip?
I do it this code:
// In the class FirstViewController.m
#import "SecondViewController"
NSString *identifier = [NSString stringWithFormat:#"%#", [self.cat objectAtIndex:indexPath.row]];
// Start the code causes an error
ViewControllerOne *instance = [[ViewControllerOne alloc]init];
instance.ID = [[NSString alloc] initWithFormat:#"%#",identifier];
// End code causes error
// In the SecondViewController.h
#property (nonatomic, retain) NSString *ID;
// In the SecondViewController.m
#synthesize ID;
The debug error:
2013-05-03 09:01:42.126 TheFreeApp[19880:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
* First throw call stack:
(0x1cbc012 0x10f9e7e 0x1cbbdeb 0x53d748 0x558b1b 0x558646 0x11eff8 0x11f232 0x5588d5 0xbf5b 0x11ce1e 0xb74e 0xed285 0xed4ed 0xaf75b3 0x1c7b376 0x1c7ae06 0x1c62a82 0x1c61f44 0x1c61e1b 0x1c167e3 0x1c16668 0x3dffc 0x2bcd 0x2af5)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Try this
[[NSUserDefaults standardUserDefaults]setValue:yourVal forKey:#"myValue"];
NSString *myVal = [[NSUserDefaults standardUserDefaults]valueForKey:#"myValue"];
Hope i helped
Cause of error is very clear from the log Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
Your ViewControllerOne is a UICollectionViewController sub class. It should be initialize with a non nil layout parameter.
UICollectionViewLayout *layout= [UICollectionViewFlowLayout new];
ViewControllerOne *instance = [[ViewControllerOne alloc]initWithCollectionViewLayout:layout];
However passing data between view controller remains there.
I am Trying to put UISegmentedControl on theNavigation Item but it crash my xcode .. I simply added the UISegmentedControl in the Interface Builder file(IB) file and then in viewDisAppear
.h
IBOutlet UISegmentedControl *segmentedControl;
.m
self.navigationItem.titleView=segmentedControl;
this simply crash my xcode with the error
2013-03-12 17:38:56.343 Magazine[4728:1dc03] *** Assertion failure in -[UINavigationBar layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776
2013-03-12 17:38:56.344 Magazine[4728:1dc03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UINavigationBar's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(0x2854012 0x1ee9e7e 0x2853e78 0x197ff35 0xe819ef 0x1efd6b0 0x7d1fc0 0x7c633c 0x7c6150 0x7440bc 0x745227 0x7458e2 0x281cafe 0x281ca3d 0x27fa7c2 0x27f9f44 0x27f9e1b 0x2d1c7e3 0x2d1c668 0xe3165c 0x2de5 0x2ce5)
libc++abi.dylib: terminate called throwing an exception
why this error is coming
UISegmentedControl * seg1 = [[UISegmentedControl alloc]
initWithItems:[NSArray arrayWithObjects:#"von mir", #"alle", nil]];
[seg1 setSegmentedControlStyle:UISegmentedControlStyleBar];
self.navigationItem.titleView = seg1;
I'm coding a simple calculator and I want to make an unique function for all 4 arithmetic buttons. I got here:
-(IBAction)simbolo1:(UIButton*)sender{
if (isNumeric(campo1.text)) {
NSString *str=campo1.text;
campo2.text=str;
int S=1;
NSString *cmp1 = [NSString stringWithFormat:#"%d", S];
sinal.text=cmp1;
campo1.text=#"";
} else {
campo1.text=#"Only numeric values";
}
}
But, for some reason, I cant get this to work. Everytime I click in the button, I get a crash.
So, I check where really was the error and I deleted the whole code:
-(void)simbolo1:(UIButton*)sender{
campo1.text=#"Only numeric values";
}
Those lines of code appear to gave me the same error as before
I'm getting a 'green :marker' on this file:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil); <--------- This line right here
[pool release];
return retVal;
}
EDIT---------------
On the debud console im getting this:
2011-09-30 09:17:14.319 Teste iPhone[28432:fb03] Applications are expected to have a root view controller at the end of application launch
2011-09-30 09:17:21.714 Teste iPhone[28432:fb03] -[Teste_iPhoneAppDelegate simbolo1]: unrecognized selector sent to instance 0x6b7c2d0
2011-09-30 09:17:21.715 Teste iPhone[28432:fb03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Teste_iPhoneAppDelegate simbolo1]: unrecognized selector sent to instance 0x6b7c2d0'
*** First throw call stack:
(0x166d062 0x17fed0a 0x166ecfd 0x15d3f10 0x15d3cf2 0x166eed9 0x16eb2 0x16e4a 0xbc3e6 0xbc8af 0xbbb6e 0x3c2a0 0x3c4c6 0x22c74 0x16399 0x1557fa9 0x16411d5 0x15a6042 0x15a492a 0x15a3dd4 0x15a3ceb 0x1556879 0x155693e 0x1438b 0x272d 0x26a5)
terminate called throwing an exception(gdb)
There is not enough information to help you. You need to look in the debugger console and show us the error and the stack.
However, I'm going to take a wild guess and say that you didn't connect the campo1 IBOutlet to its UIView in Interface Builder, and that it's nil. To fix, edit the view in Interface Builder (or in Xcode 4, just click on it), and drag the little circle next to the campo1 outlet (in the Connections tab) onto the UIView component that you want it to correspond to.
If that's not it, the error isn't here, but is probably caused by something else in your program.
[EDIT after seeing console]: Your connections look misconfigured. Why would it try to send the simbolo1 selector to Teste_iPhoneAppDelegate? It should send it to your ViewController. Did you play around with the connections (specifically, the delegate one) in Interface Builder -- or the class?
to set text in UITextField use
[campo1 setText:#"Only numeric values"];
and also don't forget to link IBOutlet UITextField* campo1; to proper UITextField in XCode IB
I have an NSObject set up to control various elements on my screen.
I initialize the class inside my View Controller like this:
self.pageSetupClass = [[PageSetup alloc] set:self.pageID];
In IB I have added my NSObject object and linked a button to an IBOutlet on it. I've also linked it to an IBAction found in the object. When I click this button the app crashes and I get this error:
2010-09-23 15:33:11.640 BookTest10[49139:207] *** -[NSCFDictionary clickSoundByte:]: unrecognized selector sent to instance 0x4b10bc0
2010-09-23 15:33:11.641 BookTest10[49139:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary clickSoundByte:]: unrecognized selector sent to instance 0x4b10bc0'
2010-09-23 15:33:11.642 BookTest10[49139:207] Stack: (
42195024,
43352876,
42203739,
41666166,
41662962,
2915566,
3413054,
3422400,
3417197,
3042792,
2934339,
2965976,
51188092,
41474204,
41470120,
51181725,
51181922,
2958194
)
terminate called after throwing an instance of 'NSException'
There is nothing in the function at the moment so it must be the calling that crashes it...right?
If you need me to post more code I certainly can. If you have any ideas I'm all ears. Thank You
Edit:
This is the contents of the function set called out when I initialize the PageSetup object:
-(PageSetup*) set:(int) i {
self = [super init];
if(self) {
self.iD=i;
self.pageSetupFile = [[NSBundle mainBundle] pathForResource:#"PageSetup" ofType:#"plist"];
self.pageSetupArray = [[NSMutableArray alloc] initWithContentsOfFile:self.pageSetupFile];
self.pageInfo = [self.pageSetupArray objectAtIndex:self.iD];
[self initializeSoundBytes];
[self initializeAnimations];
[self initializeToys];
NSLog(#"Page Setup Initializing: %#", self.pageInfo);
return self;
}
return self;
}
Another Edit:
I set my set function to return (void) and no longer initialize it using init.
I now receive this error message:
2010-09-23 17:10:05.096 BookTest10[50519:207] *** -[UITouch clickSoundByte:]: unrecognized selector sent to instance 0x4b1b580
2010-09-23 17:10:05.097 BookTest10[50519:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITouch clickSoundByte:]: unrecognized selector sent to instance 0x4b1b580'
2010-09-23 17:10:05.099 BookTest10[50519:207] Stack: (
42166352,
43324204,
42175067,
41637494,
41634290,
2886894,
3384382,
3393728,
3388525,
3014120,
2905667,
2937304,
51159420,
41445532,
41441448,
51153053,
51153250,
2929522
)
terminate called after throwing an instance of 'NSException'
Final Edit:
I had forgotten to connect my NSObject to the File's Owner in IB.
Could it be that when I reinitialize
this object...
Wait... what? In Objective-C you never call init* methods more than once.
In any case, the underlying problem appears to be a straightforward memory management issue. Something is being released before its time and it just so happens that a dictionary lands at that location. Turn on zombie detection and it'll likely catch the problem.
self.pageSetupClass = [[PageSetup alloc] set:self.pageID];
What does set: return? Is that a method of your PageSetup class? Does it return self?
Because apparently you're assigning pageSetupClass to whatever set: returns...
Unless set: returns self, you should try this:
self.pageSetupClass = [[PageSetup alloc] init];
[self.pageSetupClass set:self.pageID];
Edit:
ok, if you added the object in IB, the object was already instantiated for you when you loaded the nib, and the IBAction and IBOutlet connections have already been made.
When you do self.pageSetupClass = ..., you're setting pageSetupClass to a new instance, and that probably leaves the button with a bad target for its IBAction.
If the object was instantiated from the nib, and you have a reference to it in pageSetupClass from a IBOutlet, then just set whatever you want in the object, no need to alloc a new one.
In my Application I want to call Logout Function if user is idle for certain amount of time how to accomplish
this answer doesn't work for me
iPhone: Detecting user inactivity/idle time since last screen touch
if i subclass my app delegate class from UIApplication and implement
- (void)sendEvent:(UIEvent *)event
It gives me error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There can only be one UIApplication instance.'
I can't find the other instance of UIApplication in my application
so far i have done
instead of
#interface IdleAppDelegate : NSObject <UIApplicationDelegate> {
I have changed it to
#interface IdleAppDelegate : UIApplication<UIApplicationDelegate> {
and in the main instead of
int retVal = UIApplicationMain(argc, argv, nil, nil);
I've changed it to
int retVal = UIApplicationMain(argc, argv, #"IdleAppDelegate", #"IdleAppDelegate");
Is there anything remaining to do?
I'm getting the above error... am I missing something...?
Please Help
Thanks
Your application class is also an application delegate class - that's bad. UIApplicationMain() will create an instance of your custom application subclass, which will then try to an instance of its delegate - which is also an instance of your custom application subclass. You should separate these concerns - yes your custom app subclass needs to subclass UIApplication, but your app delegate should be a separate class that subclasses NSObject.
Try this out
-(void)applicationWillResignActive:(UIApplication *)application
{
NSLog(#"Application not Active");
// FETCH THE CURRENT TIME
}