#define PROPERTY_SECTION 0
#define SUBTOTAL_ROW 0
UITableViewCell *subtotalCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:SUBTOTAL_ROW inSection:PROPERTY_SECTION]];
When i debug it in ios 6 it working perfect, But in ios 5 app crashed with following reason"
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSIndexPath indexPathForItem:inSection:]: unrecognized selector sent to class 0x1d41f20'
*** First throw call stack:
(0x26b4022 0x2083cd6 0x26b5aad 0x261aed0 0x261acb2 0xc956a 0xc9d4a 0xca3e9 0x12af38f 0x12af5eb 0x12bdb2b 0x12af38f 0x12af5eb 0x12b04ed 0x121da0c 0x26b5e99 0x121e464 0x121e495 0x1222fc1 0x121d14b 0x16864ce 0x162bd61 0x16114d0 0x12ae5ab 0x4ab35 0x14ade29 0x14ad133 0x14ae3bf 0x14b0a21 0x14b097c 0x14a93d7 0x268899e 0x261f640 0x25eb4c6 0x25ead84 0x25eac9b 0x2d167d8 0x2d1688a 0x11e6626 0x248d 0x23b5)
terminate called throwing an exception(lldb)
+ (NSIndexPath *)indexPathForItem:(NSInteger)item inSection:(NSInteger)section; is a method only works in UICollectionView in iOS 6. You can't use it in UITableView in iOS 5.
you are probably looking for indexPathForRow:inSection:
Use
[NSIndexPath indexPathForRow:indexRow inSection:indexSection];
instead of
[NSIndexPath indexPathForItem:indexRow inSection:indexSection];
It must be a method that is added in iOS6, because it doesn't exist in the iOS5 documentation located here :
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/Reference/Reference.html
Edit: This method is only for a collection view, not a UITableView. Collection views are not supported in iOS 5
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
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"];
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.");
}
Why am I getting NSFastEnumerationMutationHandler crash all of a sudden in my code. I am blank why this crash popped up all of a sudden and how to squash it.
Crash Error:
**** Terminating app due to uncaught exception 'NSGenericException', reason: '* **Collection <__NSArrayM: 0x610000859410> was mutated while being enumerated.'*
You must be trying to change an array while you using fast enumeration.
Example
for ( id anObject in anArray ) {
if ( /* anObject satisfies some condition */ ) {
[anArray removeObject:anObject];
}
}
That shouldn't be done. Use a different array or probably filteredArrayUsingPredicate: method to filter. Remedy, however, depends on what you're trying to do.
Came here looking for a solution and ended up taking a copy of the original array to get around the issue.
for (NSObject *object in [array copy]) {
if(condition) {
[array removeObject....]
break;
}
}
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?