Basically, I have a chat room in an iphone app and I want to block inappropriate words from it. I have an array of these words called blackList. However, whenever I run the code below, I get the error that "use of undeclared identifier 'foundRange'
" and the warning that "incompatible pointer types passing NSString to parameter of type 'CFStringRef (aka 'const struct _ CFString
". What is the problem? Please provide code in your answer.Here is my code:
- (void)displayChatMessage:(NSString*)message fromUser:(NSString*)userName {
int i=0;
for (i=0; i<[blackList count] ; i++){
NSString *one = [NSString stringWithFormat:@"%@",[blackList objectAtIndex:i]];
if (CFStringFindWithOptions(message,one , CFRangeMake(0,CFStringGetLength(message)), kCFCompareCaseInsensitive, &foundRange) == true) {
/*do nothing*/
}
else {
[chat appendTextAfterLinebreak:[NSString stringWithFormat:@"%@: %@", userName, message]];
[chat scrollToBottom:chat];
}
}
}