leo
leo

Reputation: 1011

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 setAnimationPosition.

  1. "UIView may not respond to setAnimationPosition"

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

Is there anyway to suppress these two warnings?

Thanks

Leo

Upvotes: 0

Views: 818

Answers (3)

βhargavḯ
βhargavḯ

Reputation: 9836

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

Note : this is working for non-arc class.

Upvotes: 0

chmeee
chmeee

Reputation: 3638

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.

Upvotes: 4

Martin Gordon
Martin Gordon

Reputation: 36389

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.

Upvotes: 2

Related Questions