Apple rejected the application due to animationDidStop: completed: context: is a non-public api

Apple rejected my application because:

3.3.1 Applications may use only the Documented APIs in the manner prescribed by Apple and shall not use or use any private APIs. Applications must be initially written in Objective-C, C, C ++ or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C ++ and Objective-C can compile and directly link against documented APIs (for example, applications that reference the Documented APIs through intermediary translation or layer or tool compatibility are prohibited).

The non-public API that is included in your application is animationDidStop:finished:context:

This is my method in which I use the call to the above method:

 - (void)hideMsg { // Slide the view off screen CGRect frame = self.view.frame; int retractY; int retractX; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.75]; retractY = -190; retractX = 0; frame.origin.y = retractY; frame.origin.x = retractX; self.view.frame = frame; //to autorelease the Msg, define stop selector [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; [UIView commitAnimations]; } 

I use this method to display a rolling message after a specific event occurs.

But I did not define this method. When I tried to find it, it was found only in CAAnimation.h, UIView.h.

Has anyone encountered the same problem? How did you fix this?

+4
source share
3 answers

The whole point of setAnimationDidStopSelector: is that you tell the system to invoke your own method when the animation is complete. So, if you are going to pass in this selector, you need to define this method yourself in your class:

 - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { // do whatever. } 

Please note that the documentation for setAnimationDidStopSelector: states that you should use a selector of this form, but in fact you can also use a shorter version, such as a crazy dog. But it’s better to study the animation attribute, context, and other elements.

You need to add a method to any class the code is in, because you pass yourself as an animation delegate.

For some reason, they probably also have an internal UIView method with the same name, so you are accused of using an undocumented API.

+7
source

If you need to perform an action (for example, freeing objects) when the animation has finished, you must define your own method and then pass the selector for the UIView setAnimationDidStopSelector.

For instance:

  - (void) messageSlideFinished {
  // do some stuff here
 }

Then when setting up the animation you will do

  [UIView setAnimationDelegate: self];
 [UIView setAnimationDidStopSelector: @selector (messageSlideFinished)];
+5
source

animationDidStop iOS delegate . You must use a different name for your selector .

-1
source

All Articles