Help with: Apps that use non-public APIs will be rejected
I have an app that I submitted to the App Store a few times and I keep getting the same return:
The non-public API that is included in your application is addTarget:action:forEvents. If you have defined a method in your source code with the same name as this API, we suggest altering your method name so that it no longer collides with Apple's private API to avoid your application being flagged in future submissions.
I have done a 'Find in Project' and 'Find in Frameworks' and I can't find where I am redefining addTarget:action:forEvents anywhere. I used otool and strings and otool can't find it either. Strings shows it twice, but it is surrounded by other apple iOS methods both times.
Does anyone know how to use strings to find the framework that is redefining addTarget:action:forEvents?
Are you specifically searching for "addTarget:action:forEvents"? Because you won't find anything that way as the declaration for this method will include data type specifications and passed variable declarations.
Are you specifically searching for "addTarget:action:forEvents"? Because you won't find anything that way as the declaration for this method will include data type specifications and passed variable declarations.
It's also weird that it specifies "forEvents" when this method for the UIControl class is "forControlEvents".
Try just searching for "addTarget".
The UIControl method is public. I believe it's addTarget:action:forEvents: thats private.
I agree. Try searching for "addTarget:" or "forEvents:"
In general, if you use a method and the compiler warns you that the target object may not respond to that message, you might be in trouble. Either your program is going to crash at runtime, you're calling a method inside one of your objects that you didn't put in the interface, or you're calling a non-public method of a system framework.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
I am just adding a target to a button (over a view) that dismisses a modalViewController. Is there a better way to do this without angering the Gods of Apple? ;-)
I am just adding a target to a button (over a view) that dismisses a modalViewController. Is there a better way to do this without angering the Gods of Apple? ;-)
Thanks for anything!!
Ok, search the XCode docs for addTarget:action:forEvents. Can you find such a method?
If not, search the XCode docs for "addTarget:" and look for similar-named methods. You should only see 2 under the "API" results group. One of them is what you want, and it was already mentioned by me and another poster.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
Duncan,
I appreciate your input and your patience. I see what you are saying. And I see the methods in the docs.
I thought I was just using these methods to do something, not redefining them.
Forgive my ignorance, but I don't know how I am overriding the private API by calling what I think is just an objective-c method provided by apple.
Sorry, but could you explain how I am redefining the method in my code below? I am not trying to be obtuse. I am just trying to figure out how my code is redefining versus just using the method.
Duncan,
I appreciate your input and your patience. I see what you are saying. And I see the methods in the docs.
I thought I was just using these methods to do something, not redefining them.
Forgive my ignorance, but I don't know how I am overriding the private API by calling what I think is just an objective-c method provided by apple.
Sorry, but could you explain how I am redefining the method in my code below? I am not trying to be obtuse. I am just trying to figure out how my code is redefining versus just using the method.
Thanks for any input. I do appreciate it!!!!!!
Doug
Dude, you got the method name wrong. It's not addTarget:action:forEvents: It's something close to, but not quite, that.
The method you want is in UIControl. Find it, and figure out what's different about your method name.
You need to figure this out for yourself. Look at the docs carefully. Look for a method that's really close to that name, but slightly different. Look at every single character of the method name, one at a time. The official method name and your code are different.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.