Question

I am using a UISearchDisplayController in my app. Since iOS 7 a strange bugg occurs, when klicking on the searchBar and the keyboard is displayed, the app gives several errors if the user decides to klick at the searchBar once more while the "searchField" is empty.

The bugg is discussed in this thread: UISearchBar CGContext ERROR

Now I have 2 questions: is there any way to solve tihs problem? And if not, can you upload the app to the App Store with this bugg in the system?

Regards

My code:

- (void)viewDidLoad
{
[super viewDidLoad];


if ([self systemVersionGreaterThanOrEqualTo:@"7.0"])
{

    [[UISearchBar appearance]setSearchFieldBackgroundImage:[UIImage imageNamed:@"searchbar_bg"] forState:UIControlStateNormal];
    self.navigationItem.titleView = searchBar;
}   
}

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {

[self.searchDisplayController setActive:YES animated:NO];

// Hand over control to UISearchDisplayController during the search
// searchBar.delegate = (id <UISearchBarDelegate>)self.searchDisplayController;
return YES;
}

- (void) searchDisplayControllerDidBeginSearch:(UISearchDisplayController
                                            *)controller {
// Un-hide the navigation bar that UISearchDisplayController hid
[self.navigationController setNavigationBarHidden:NO animated:NO];
}

 - (void) searchDisplayControllerWillEndSearch:(UISearchDisplayController
                                           *)controller {
searchBar = (UISearchBar *)self.navigationItem.titleView;
   // Manually resign search mode
[searchBar resignFirstResponder];
// Take back control of the search bar
searchBar.delegate = self;
}
Was it helpful?

Solution

You can publish your app with that error occurring because it doesn't crash your app and it is a framework error. Don't try to fix this because you would be trying to fix something that doesn't hurt your app at all.

Also, as bug reports have been already filed about this, you can rest assured that the issue will be fixed soon.

OTHER TIPS

        - (BOOL)searchDisplayController:(UISearchDisplayController *)controller 
                shouldReloadTableForSearchString:(NSString *)searchString{
              }

and set frame if it is greater than iOS7

and i do not see that u r using this

   - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)
            controller {
            [self.searchDisplayController.searchResultsTableView setDelegate:self];
             }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top