3

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;
}
Community
  • 1
  • 1
Jesper Martensson
  • 1,238
  • 3
  • 18
  • 44

2 Answers2

1

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.

duci9y
  • 4,128
  • 3
  • 26
  • 42
  • 1
    Thanx for your reply. I found this at other places, in TextField's aswell. I bet many have this in thier apps without knowing it! I will upload it to the store then :=) – Jesper Martensson Dec 09 '13 at 11:55
  • Yes of course, I am going to publish my app with the error too. – duci9y Dec 09 '13 at 14:20
0
        - (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];
             }
viswateja
  • 327
  • 2
  • 16