4

On a project I'm working on collaboratively, I've seen that my coworker has used the following code to access/modify non-public properties of UISearchBar:

something = [self.searchBar valueForKey:@"_searchField"];
[searchField setValue:grayColor forKeyPath:@"_placeholderLabel.textColor"];
...

I'm not sure if this is considered using private API by Apple. Would these cause App Store rejection? I've seen some questions regarding private API usage, but couldn't find any answer to this exact question.

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • 5
    I don't believe it will get picked up as private API - the method call isn't a private method, but it is using undocumented properties, so it could break in the future. The same effect could probably be achieved using the appearance api – Paulw11 Dec 20 '14 at 01:54

1 Answers1

3

Ive used what youve described above in numerous apps, all of which never have been rejected. Just keep an eye on it with every new iOS release, just incase things break.

So in regards to 'Would these cause App Store rejection?', from my experience, no.

DevC
  • 6,982
  • 9
  • 45
  • 80