I have faced a very strange behavior for textDidChange delegate method of UISearchBar. Here is my code
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
searchText = [searchText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (![searchText isEqualToString:@""]) {
[self searchedWithText:searchText]; // I am using this method to fetch my search results from coredata
[searchBar becomeFirstResponder]; // For making the search field active
}
}
-(void)searchedWithText:(NSString *)searchText {
// In this method the type of searchText is shown as NSTaggedPointerString and the value is nil
}
I did a po for searchBar in the delegate method and I got the below message
(lldb) po searchBar
error: warning: couldn't get cmd pointer (substituting NULL): extracting data from value failed
Couldn't materialize: couldn't get the value of variable searchBar: variable not available
Errored out in Execute, couldn't PrepareToExecuteJITExpression
My issue is the searchText parameter in my searchedWithText method is nil. So the results from coredata is nil. What am I doing wrong here? Thanks in advance