I have a search bar that once the search button is clicked, will call another class that will set a local NSString for that class. The issue is when setting it in a function, I can call it there but if I call it from outside of that function when I move the user to that ViewController, it outputs weird things such as:
<UIKBCacheToken: 0x10c385df0>
Here what I am doing:
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
NSString *searchType = searchBar.text;
// SET TEXT
search_results* myScript = [[search_results alloc] init];
[myScript startProcess:searchType];
[self performSegueWithIdentifier:@"moveToSearchResults" sender:self ];
}
The above is my calling method within another class.
Here is my startProcess:
- (void)startProcess:(NSString*)searchPeram {
NSString *check = searchPeram;
useToSearch = check;
NSLog(@"%@",useToSearch);
}
This works great and that variable is set and outputs correctly with lets say test.
Now once the performSegueWithIdentifier is called. I try outputting the variable in the ViewdidLoad. But it would output weird things such as the above first statement. The NSString is being called as followed in the .m file:
@implementation search_results
NSString *useToSearch = @"";
- (void)viewDidLoad
Suggestions and thoughts?