In article <4a778fa8$0$2475$db0fefd9 at (no spam) news.zen.co.uk>,
"Joe Butler" <ffffh.no.spam at (no spam) hotmail-spammers-paradise.com> wrote:
for(NSObject *el in mutArr){
FYI this would generally be written as "for (id el in mutArr)".
SEL sel= at (no spam) selector(lowercaseString);
if([el respondsToSelector:sel){
NSString *str3= [el lowercaseString];
===========================================
WARNING: 'NSObject' may not respond to '-lowercaseString'
===========================================
}
}
It's because "el" is still an NSObject, and the compiler doesn't have
any reason to expect it to respond to NSString methods. The
"respondsToSelector" check happens at run time, not at compile time, so
its meaning is lost to the compiler.
Make it
NSString *str3 = [(NSString *)el lowercaseString];
And the compiler should be happy.
--
Tom "Tom" Harrington
Independent Mac OS X developer since 2002
http://www.atomicbird.com/