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
.
"UIView may not respond to setAnimationPosition"
"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.
精彩评论