views:

26

answers:

2

I got a warning message in

NSCharacterSet *myCharSet3 = [NSCharacterSet characterSetWithCharactersInString:query3]; 
int chr_count3;
chr_count3=[myCharSet3 count];

How to fix that warning ?

+1  A: 

specifically, NSCharacterSet instances do not respond to the selector count.

if you implemented count as a category method (which should be prefixed to avoid collisions), then you will need to include that header file which declares it.

attempts to call this method at runtime will raise an exception.

Justin
+2  A: 

NSCharacterSet does not officially provide a count method. However in my testing, [myCharSet3 count] actually gives the correct result. So just to get rid of the warning:

chr_count3 = (int)[myCharSet3 performSelector:@selector(count)];

But I don't think it's a good idea.

Arrix