gpt4 book ai didi

ios - 苹果因为 animationDidStop :finished:context: is a non-public api 拒绝了应用

转载 作者:可可西里 更新时间:2023-11-01 05:04:56 26 4
gpt4 key购买 nike

Apple 拒绝了我的应用,因为:

3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally 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 may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

您的应用程序中包含的非公共(public) API 是 animationDidStop:finished:context:

这是我调用上述方法的方法:

- (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];

}

我正在使用此方法在特定事件发生后显示滑动消息。

但是我没有在任何地方定义这个方法。当我试图找到它时,它只在 CAAnimation.h、UIView.h 中找到。

有人遇到过同样的问题吗?你是怎么解决的?

最佳答案

setAnimationDidStopSelector: 的全部要点是您告诉系统在动画完成时调用您自己的自定义方法。因此,如果您要传递该选择器,您需要自己在类中定义该方法:

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

请注意 setAnimationDidStopSelector: 的文档说您必须使用这种形式的选择器,但实际上您也可以使用像 mad-dog 描述的更短的选择器。但是,最好获取 animationID 和上下文以及其他要检查的项目。

您需要将该方法添加到该代码所在的任何类,因为您将自己作为动画委托(delegate)传递。

出于某种原因,他们可能还有一个同名的内部 UIView 方法,这就是为什么您被指控使用未记录的 API。

关于ios - 苹果因为 animationDidStop :finished:context: is a non-public api 拒绝了应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3455604/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com