LoginSignup
25
24

More than 5 years have passed since last update.

Warningを無視する#pragma

Last updated at Posted at 2013-11-06

随時追加

ios6とかでdepricated

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        BOOL available = [TWTweetComposeViewController canSendTweet];
#pragma clang diagnostic pop

Category is implementing a method which will also be implemented by its primary class

カテゴリの実装でメソッドをオーバーライドするなという警告

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
- (void)addRoundedRectToPath:(CGRect)rect 
                     context:(CGContextRef)context 
                   ovalWidth:(CGFloat)ovalWidth 
                  ovalHeight:(CGFloat)ovalHeight 
{
    .....
}
#pragma clang diagnostic pop

PerformSelector may cause a leak because its selector is unknown

ARC環境下でのワーニング。-performSelector:からの返り値をコントロールできなくて出る。

    SEL sel = @selector(doSomething);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    [obj performSelector:sel];
#pragma clang diagnostic pop

Unused parameter '****'

パラメータを使えーって言っていますので変数名の頭にattribute((unused))を追加。

    [hoge performRequestWithHandler:^(NSData *responseData, __attribute__((unused)) NSHTTPURLResponse *urlResponse, NSError *error) {
        completion(responseData, error);
    }];

参考

25
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
24