Trying to subclass CCMenuItemImage - ios

Im subclassing CCMenuItemImage with this init method
-(id)initWithChildren:(id)targetedApplication {
if(self = [super initFromNormalImage:#"Answer_Box.png" selectedImage:#"Answer_Box.png" disabledImage:#"Answer_Box.png" target:targetedApplication selector:#selector(answerButtonTapped:)] ) {
NSLog(#"Yes?");
return self;
}
return self;
}
-(void)answerButtonTapped:(id)stuff {
NSLog(#"Answer Button Tapped");
}
and it crashes every time with this error in the console
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil'
Thanks in advance for any help.

is -answerButtonTapped a method of targetedApplication? It should be that one. The error says that there is no such a function in target. Or you can pass "self" instead of "targetApplication"

Related

unrecognized selector sent to class, along with -> terminate_handler unexpectedly threw an exception in objective c

-(void)sliderClicked
{
[self.window bringSubviewToFront:btntemp];
[self.window bringSubviewToFront:sliderView];
if (sliderView.frame.origin.x==0)
{
btntemp.hidden = YES;
[self performSelector:#selector(presentLeftMenuViewController:)]; // Getting Error in this line
}
else
{
btntemp.hidden = NO;
[self performSelector:#selector(presentLeftMenuViewController:)]; // Getting Error in this line
}
}
above Method is in AppDelegate.m , I am getting error like
+[RESideMenu presentLeftMenuViewController:]: unrecognized selector sent to class 0x10e7902b8
libc++abi.dylib: terminate_handler unexpectedly threw an exception.
RESideMenu classes are from Third party, Method -> presentLeftMenuViewController is from them
will Anybody Please Help me to fix this issue.

iOS : initWithCoder fail : 'Exercised class for selector implementation needs to be pushed'

I have an UIImageView subclassed as CLImageView that has been implemented with lazy load.
Just ago I have encountered this error message :
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Exercised class for selector implementation needs to be pushed'
*** First throw call stack:
at line : if(self=[super initWithCoder:aDecoder]) {
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if(self=[super initWithCoder:aDecoder]){
self.placeholderImage = nil;
self.delegate = nil;
self.cacheEnabled = NO;
self.prettyLoad = NO;
}return self;
}
I have never seen this error until 5 years of iOS programming, and I could not find any information on this kind of message here.
If anybody can drop me some ideas would be grateful.
If you need more information just leave a comment or reply.
Thank you so much.

Peek in iOS 9 App Crashing

I am trying to do Peek and Pop in my iOS 9 capable app. The view in question has a UITableView, so I have in my code:
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {
// check if we're not already displaying a preview controller
if ([self.presentedViewController isKindOfClass:[WebViewController class]]) {
return nil;
}
// shallow press: return the preview controller here (peek)
self.webViewController = [[[WebViewController alloc] initWithNibName:#"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
return self.webViewController;
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {
// deep press: bring up the commit view controller (pop)
self.webViewController = [[[WebViewController alloc] initWithNibName:#"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
[self showViewController:self.webViewController sender:self];
}
WebViewController is the ViewController I have already set up to display the content when the row of the tableview is selected. The error I get is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
*** First throw call stack:
(0x182160f5c 0x19764bf80 0x182160ea4 0x182fb8868 0x1001307a4 0x1876cf9ac 0x1876cf720 0x187a025f8 0x187960844 0x18796cde4 0x1876a91e4 0x182117c30 0x1821159d4 0x182115e04 0x182044dc0 0x18d4e0088 0x18771ef60 0x10014ca68 0x197e6a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
Your log it's saying exactly what is wrong with your code:
-[__NSCFConstantString stringByAppendingString:]: nil argument'
You are performing stringByAppendingString passing a value that is nil
Also, autorelease is not used anymore if you are using ARC (it's default by now)

CMDActivityViewController crashing in iOS8

Getting crash in CMDActivityViewController for iOS8.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ArtViewController activityViewController:dataTypeIdentifiersForActivityType:]: unrecognized selector sent to instance 0x7acb0b80'
Solution to this-
In dataTypesForActivityType method of "CMDActivityViewController.m", return nil , instead of the array dataTypes.
Use this Method as it is
- (NSArray *)dataTypesForActivityType:(NSString *)type {
return nil;
}

Objective C - -[__NSCFString _isAncestorOfFirstResponder] Error

I'm trying to create this application, when you press on a tablecell you get shown the ViewController, and the variable get's set in the other view controller. Although i'm getting a few errors when i press the uitablecell.
Error:
2013-04-06 22:47:25.970 iFSX Guide[1069:907] Called
2013-04-06 22:47:26.009 iFSX Guide[1069:907] -[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390
2013-04-06 22:47:26.016 iFSX Guide[1069:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390'
*** First throw call stack:
(0x319b22a3 0x3964c97f 0x319b5e07 0x319b4531 0x3190bf68 0x33832beb 0x338a837f 0x338548fb 0x33a95619 0x338a79b9 0x338a5fe7 0x339c83ef 0xa22a5 0x3387c28d 0x338fef81 0x322c0277 0x319875df 0x31987291 0x31985f01 0x318f8ebd 0x318f8d49 0x354ba2eb 0x3380e301 0xa19d1 0x39a83b20)
libc++abi.dylib: terminate called throwing an exception
The code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)in dexPath{
NSLog(#"Called");
Aircraft = indexPath.row;
[self performSegueWithIdentifier:#"ToSections" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:#"ToSections"]){
AirplaneSections *sections = (AirplaneSections *)segue.destinationViewController;
sections.plane = Aircraft;
}
}
I've found out that it's an error on ViewDidLoad on the viewcontroller.
NSString *quickTemp = [NSString alloc];
switch (plane) {
case 0:
quickTemp = #"Boeing 737-800";
break;
default:
break;
}
TitleLabel.text = quickTemp;
*/
I'm doing something wrong there.
Are you using ARC? This sort of problem usually indicates there's a memory error somewhere. Basically, some code somewhere is trying to access an object that was already released. This makes everything go kaboom.
If you aren't using ARC, you should turn it on.
After that, the next thing you should do is run the static analyzer. Fix anything that comes up.
If that doesn't fix the problem, in Xcode, add a breakpoint that stops when an Objective-C exception is thrown. It should show you where exactly this problem is happening.
If that doesn't help, run your code under Instruments' and the Zombie tool. This will show you exactly where you tried to access memory that was already released.

Resources