1

I recently submitted an app for app review but I got rejected because of the use of a private API. I'm still a bit new to iPhone developing so I was wondering if someone could help me understand how this part was rejected:

UISearchBar *searchBar = [[[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0)] autorelease];
searchBar.showsCancelButton = NO;
searchBar.placeholder = @"Search Exhibitors";
[searchBar sizeToFit];

[self.tableView setTableHeaderView:searchBar];

UISearchDisplayController *searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];  

[self performSelector:@selector(setSearchDisplayController:) withObject:searchDisplayController];

[searchDisplayController setDelegate:self];  
[searchDisplayController setSearchResultsDataSource:self];  
[searchDisplayController setSearchResultsDelegate:self];
[searchDisplayController release];

The part that they mentioned was the "setSearchDisplayController". I based the searching of a UITableView on the example given here. So can anyone explain why this is considered a private API?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Adun
  • 71
  • 4

3 Answers3

1

Is -setSearchDisplayController: mentioned anywhere in the documentation (I don't think it is)? If it is not then it's not a public API.

The fact that you have to use -performSelector:withObject: and can't call it directly is another giveaway. -setSearchDisplayController obviously isn't included in any header files.

Thomas Müller
  • 15,565
  • 6
  • 41
  • 47
0
[self performSelector:@selector(setSearchDisplayController:) withObject:searchDisplayController];

Is a private API call and it can cause an app rejection by Apple, I know because it happened to an app I'm working on.

Thad
  • 121
  • 2
  • 5
0

From Apple's UIViewController doc:

@property(nonatomic, readonly, retain) UISearchDisplayController *searchDisplayController
This property reflects the value of the searchDisplayController outlet that you set in Interface Builder. If you create your search display controller programmatically, this property is set automatically by the search display controller when it is initialized.

estobbart
  • 1,137
  • 12
  • 28