Getting above error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CCProgressTimer progressWithSprite:]: unrecognized selector sent to class 0x1a8194
here is my code
arrow_base = [CCSprite spriteWithFile:ARROW_OUTER];
arrow_base.position = ccp(m_pBullet.position.x,m_pBullet.position.y);
arrow = [CCProgressTimer progressWithSprite:#"arrow_inner.png"];//[CCSprite spriteWithFile:ARROW_INNER]];
arrow.type=kCCProgressTimerTypeHorizontalBarLR;
//arrow.type = kCCProgressTimerTypeBar;
// arrow.midpoint = ccp(0,0.5);
arrow.position = ccp(m_pBullet.position.x,m_pBullet.position.y);
arrow.percentage = 100;
[m_pBulletCover addChild:arrow_base];
[m_pBulletCover addChild:arrow];
progressWithSprite takes CCSprite object as input not NSString.
arrow = [CCProgressTimer progressWithSprite:[CCSprite spriteWithFile:#"arrow_inner.png"]];
i have check its library file,the error cause as there is no method ProgressWithSprite, instead of that its having progressWithFile method. May be its due to Cocos2d version problem as help provided by LearnCocos2d,
So i use it now and its working fine
arrow = [CCProgressTimer progressWithFile:#"arrow_inner.png"];
Related
I'm trying to support undo/redo in an iOS app that uses GLKit.
When I try the following:
GLKVector3 currentTranslation = _panningObject.translation;
[[self.undoManager prepareWithInvocationTarget:_panningObject] setTranslation:currentTranslation];
I get a crash:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMethodSignature signatureWithObjCTypes:]: unsupported type encoding spec '(' in '4(_GLKVector3={?=fff}{?=fff}{?=fff}[3f])8''
Any ideas?
Still got no idea why GLKVector3 won't play nice, but I'm using this as a workaround:
- (void)setObject:(DrawableObject *)object translationX:(CGFloat)x y:(CGFloat)y z:(CGFloat)z {
GLKVector3 translation = GLKVector3Make(x, y, z);
GLKVector3 currentTranslation = object.translation;
[[self.undoManager prepareWithInvocationTarget:self] setObject:object
translationX:currentTranslation.x y:currentTranslation.y z:currentTranslation.z];
[object setTranslation:translation];
}
EDIT:
https://twitter.com/bddckr/status/370144778090192896
https://twitter.com/bddckr/status/370145021804425216
Im Extracting Data from NSMuableDictionary to NSString and try compering to String like this:
NSDictionary *error = [[NSDictionary alloc]init];
NSString *errorCode = [[NSString alloc]init];
error = [sing.globalCallsDitionary valueForKey:#"Error"];
NSLog(#"error code %#",[error valueForKey:#"error_code"]);
errorCode = [error valueForKey:#"error_code"];
if ([errorCode isEqualToString:#"-1"]) {
When the if statement executed i get this error talking about an array, the error looks like this:
2012-04-27 06:34:49.686 CallBiz[10319:707] error code (
"-1"
)
2012-04-27 06:35:00.602 CallBiz[10319:707] -[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x16fc10
2012-04-27 06:35:00.608 CallBiz[10319:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x16fc10'
*** First throw call stack:
(0x3541f88f 0x36846259 0x35422a9b 0x35421915 0x3537c650 0xb2a3 0x353793fd 0x32458faf 0x32458f6b 0x32458f49 0x32458cb9 0x324595f1 0x32457ad3 0x324574c1 0x3243d83d 0x3243d0e3 0x3667222b 0x353f3523 0x353f34c5 0x353f2313 0x353754a5 0x3537536d 0x36671439 0x3246be7d 0x2e61 0x28fc)
terminate called throwing an exception
It is as xCode is looking on my NSString *errorCode = [[NSString alloc]init]; as if it is an NSArray, can someone help me with this?
Error occurs because your errorCode came as a array, instead of string. If you are sure that only 1 object come here, then you can use -
if ([[errorCode objectAtIndex:0] isEqualToString:#"-1"])
It will work, although it will through a warning, because errorCode is defined as a string object. So you ned to sure what data you are getting in response and then define data structure appropriately.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I check if a UILabel's value is more than 0 in an if statement?
Why is the following code not working?
if([Period2 isEqualToString:#"PSHEEC"])
{
NSLog(#"TEST");
}
I am getting this error:
2011-12-02 08:45:52.579 iDHSB[7605:707] -[UILabel isEqualToString:]:
unrecognized selector sent to instance 0x4884c50 2011-12-02
08:45:52.581 iDHSB[7605:707] * Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[UILabel
isEqualToString:]: unrecognized selector sent to instance 0x4884c50'
* First throw call stack: (0x323e28bf 0x35cfa1e5 0x323e5acb 0x323e4945 0x3233f680 0x3152b191 0x9c905 0x316cf871 0x323e5814
0x323407e1 0x323403ff 0x34767e5b 0x323e4ab3 0x3233f680 0x323e5814
0x323407e1 0x33dcb43d 0x33dde8dd 0x323b6b03 0x323b62cf 0x323b5075
0x323384d5 0x3233839d 0x378b7439 0x315558e1 0x2d77 0x27c0) terminate
called throwing an exception[Switching to process 7171 thread 0x1c03]
(gdb)
The error you are getting is propably due to memory mamagement issues, the pointer of Period2 is not pointing to you string any more and is now pointing to some label. Make sure you have retained it correctly.
On an other note, variable, properties, methods should not start with a capital, and if you label is a properties you should use self.period2 .
if period2 is your label use...
[period2.text isEqualToString:#"PSHEEC"]
It may be helpful
NSString *str = label.text;
if([str isEqualToString:#"PSHEEC"])
{
NSLog(#"Equal");
}
else
{
NSLog(#"Not Equal");
}
What is Period2? You can't test equivalence that way. If you want to test string equivalence, you need to do something like the following:
(assuming Period2 is an NSString)
if ([Period2 isEqualToString:#"PSHEEC]) {
NSLog(#"They are equal.");
}
My created application crashed when executing the below lines of code
where c1 is an integer variable.
NSString *path = c1.stringValue;
Shows the following error in log:
-[NSCFString stringValue]: unrecognized selector sent to instance
0x5566e80 2011-05-11 14:56:15.813
e-TREND[1552:207] Uncaught Exception
happens!! (NSInvalidArgumentException:
-[NSCFString stringValue]: unrecognized selector sent to instance
0x5566e80) 2011-05-11 14:56:15.816
e-TREND[1552:207] * Terminating app
due to uncaught exception
'NSInvalidArgumentException', reason:
'-[NSCFString stringValue]:
unrecognized selector sent to instance
0x5566e80'
if anyone have any idea to solve this issue , please answer accordingly.
where c1 is an integer variable
What does that mean? How is c1 declared?
If c1 were an int, then c1.stringValue wouldn't even compile.
The dot syntax only works when the object reference -- c1 -- is of a specific object reference type (not id) and that reference-- that class-- responds to the method.
So, you have something like:
MyThingThatRespondsToStringValue *c1;
And then you are, somewhere, assigning an instance of NSString to that variable which leads to the crash.
Please try this,
NSString *path = [NSString stringWithFormat:#"%#",c1];
Assume C1 is the instance of NSString.
Try with
NSString *path = [NSString stringWithString:c1];
OR
NSString *path = [[NSString alloc] initWithString:c1];
Okay, I have an Book Object Class. That has Book.name and Book.id as extensions.
Book.name being NSString. Which is what should be searchable and listed in UITableView.
NSMutableArray *matchingSymptomsArray = [[NSMutableArray alloc] initWithCapacity:50];
for(NSMutableArray *letterArray in DataArray){
for(Book *bk in letterArray){ //Heres the ERROR
NSLog(#"Uptil NEW");
if([bk matchesSearchString:searchString]){
//I couldnt reach here, according to debugging and Logs//
[matchingSymptomsArray addObject:bk];
}
}
}
DataArray is where all the Books are held.. more than a hundred. Its the main datasource for the UITableView. I'm trying to search and match each letter of the string with the Book.name, but even before I can begin, I cant do the
for(Book *bk in LetterArray) //producing the error..
What seems to be the problem?
This is the error in console
**** -[Book countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x55c110
2009-09-29 06:17:41.073 Smart Diagnosis[3897:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[Book countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x55c110'
Any work arounds??
thanks for your help :)
Try this:
for (id bk in letterArray) { }
Did you check that letterArray isnt nil or empty?
Did you check that letterArray isnt nil or empty?