开发者

How to suppress warning of private API?

I am trying to use a private animation (since I am not submitting it to App Store)

 [UIView setAnimationTransition:103 forView:detailVC.view cache:YES];
 [UIView setAnimationPosition: CGPointMake(262, 723)];

I get two warnings from 开发者_如何学JAVAsetAnimationPosition.

  1. "UIView may not respond to setAnimationPosition"

  2. "Semantic Issue, method setAnimationPosition not found".

Is there anyway to suppress these two warnings?

Thanks

Leo


Simply declare them in a category declaration, like follows:

@interface UIView (PrivateMethods)
+ (void)setAnimationPosition:(CGPoint)point;
@end

However, as noted by Martin Gordon, Apple will reject your app if it uses private APIs.


A good development practice is to treat warnings as errors (unless you have a really good reason not to).

In your case, use of private APIs should be considered an error because Apple will reject your app if it uses undocumented APIs.


You can simply add -w Complier Flag under Build Phases > Compile Sources against yourfilename.m

Note : this is working for non-arc class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜