Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

In .h file,

NSString *deal_desc,*terms_cond,*merchant_desc,*locationaddress,*locationcity,*locationstate;

Trying to find the length of the 'detailarray', so that it could help me to allocate the height of the cell in table.

deal_desc = @"sadsad dsa dsad dsad sadsa dsad sadsad adsad sadsad adssad sad adsad sada";
terms_cond = @"sadsad adssa sad asdsad&nbsp";
merchant_desc = @"merchant description describes in detail about merchants";

locationaddress =@"42, South St";
locationcity = @"San Jose";
locationstate = @"California";

location = [[NSMutableArray alloc]init];
NSLog(@"location is %@ \n",location);
detaildescription = [[NSMutableArray alloc]init];


[location addObject:locationaddress];
[location addObject:locationcity];
[location addObject:locationstate];

[detailarray addObject:deal_desc];
[detailarray addObject:terms_cond];
[detailarray addObject:location];
[detailarray addObject:merchant_desc];
NSLog(@"detailarray values are %@ \n",detailarray);

While selecting the tablecell, i try to calculate the length of the string and array in 'detailarray', here

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self.tableview beginUpdates];
id1=indexPath.row;
size = [ detailarray[id1] length];
NSLog(@"size of detaildesc is %d \n",size);
 [self.tableview endUpdates];
[tableview reloadData];

}

The problem that makes my app to crash is, finding the 'location' length, error as follows:'-[__NSArrayM length]: unrecognized selector sent to instance 0x717e8e0'

Can any one help me in this regards.

share|improve this question
 
Check out the NSArray Class Reference to see the complete list of members that may be used. Length is not one of them. –  Jeremy Sep 11 at 7:55
 
@Jeremy, ya ll check that.... –  sathya Sep 11 at 7:59

1 Answer

The proper function to check size of for NSMutableArray is:

- (int) count;

Length is only for NSString

share|improve this answer
 
ya will try to find out another solution to that problem... –  sathya Sep 11 at 7:59
 
There is no other solution if you want to keep using NSMutableArray –  Grzegorz Krukowski Sep 11 at 8:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.