NimbleKit - fast iOS app development

Access a UITextField using IBOutlet's?

Ask questions and share your skills here

Re: Access a UITextField using IBOutlet's?

Postby sunny » Sat Jan 02, 2010 5:13 pm

Also, does this break the rules of apple's API so possible rejection?

I don't get, what exactly you think breaks the rules because I don't see anything wrong as far
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Access a UITextField using IBOutlet's?

Postby tarnfeld » Sat Jan 02, 2010 8:05 pm

I asked a vauge question on stackoverflow about it - and they said that the elements were in a subview, and i got the same code as you gave me.. but someone said that this uses apple's private API? Perhaps not just thought i would check :D
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Access a UITextField using IBOutlet's?

Postby sunny » Sat Jan 02, 2010 8:13 pm

they probably misunderstood, no private API used here, among those subviews there are objects that are apple's private and if you will call any method from those objects that would be rejected, but you did not, all you get is YOUR OWN control, not Apple's, so nothing to worry about.
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Access a UITextField using IBOutlet's?

Postby tarnfeld » Sat Jan 02, 2010 8:26 pm

Aw great - so what would i need to do (in my terms) that would cause rejection... ?
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Re: Access a UITextField using IBOutlet's?

Postby sunny » Sat Jan 02, 2010 8:41 pm

for example you could want disable scrolling of your webview programmatically instead of doing that in html, in this case you would loop though webview subviews and get private Apple's subview which is responsible for scrolling and call method which disable's scrolling. The information on what method to call is private and not available in documentation, however if you are a little hacker it's pretty easy to obtain the list of those methods (so called, private APIs), and then call needed method (let's assume it's called "setScrollingDisabled") which will cause your application to be rejected. As long as you use documented APIs your application can not be rejected, to check that you can search for every method in your code if it is available in documentation, if it's there it means everything is ok.
Also there is another way to get rejected due to private APIs, let's assume you have no idea about names of private APIs and you write your own method which has only clean documented code. If somehow the name of your method will be the same as name of any private API your application will be rejected. This happens because Objective-C architecture, you can not know what object method was sent to, that's why Apple's bans everything. I once got into trouble because of this, many programmers would name method "setParameters" if they need to set parameters in that object and then they get rejected (?!), one of Apple's private APIs names also setParameters and there is no way to know if I'm using my own method or private API, ofc Apple would not bother investigating deeper, so they just reject. After this I always name my methods with product specific codes like "NK", so setParameters became setNKParameters and so on.
User avatar
sunny
Staff
 
Posts: 2666
Joined: Sat May 30, 2009 5:18 am
Location: Palo Alto, California

Re: Access a UITextField using IBOutlet's?

Postby tarnfeld » Sat Jan 02, 2010 10:31 pm

Ah i see, thanks for the in-detail reply! :)
tarnfeld
 
Posts: 189
Joined: Mon Jun 15, 2009 9:37 pm

Previous

Return to How To...

Who is online

Users browsing this forum: No registered users and 0 guests