Suppress obsolete warnings in Xcode

dismissModalViewControllerAnimateddeprecated: first deprecated in iOS6.0

  • The purpose of my deployment is 6.1, and Xcode5.1.
  • I want to remove this warning for a 6.1 simulator. Is this possible ?????
  • If I started it by selecting in ios 5.1, then no warnings.
+4
source share
4 answers

If I'm right, you just want to suppress warnings.

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

This is just to suppress warnings. In releases, you should not use legacy features.

EDIT: To disable custom warning code, use:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

    [self dismissModalViewControllerAnimated:YES];

#pragma clang diagnostic pop
+22
source

@ n00bProgrammer thanks for your reply.

, , iOS, , , - , , .

, , "-Wconversion".

    if (SYSTEM_VERSION_LESS_THAN(@"6.0")) {
        #pragma clang diagnostic push
        #pragma clang diagnostic ignored "-Wdeprecated-declarations"
        #pragma clang diagnostic ignored "-Wconversion"
        [controlCenter.label setLineBreakMode:UILineBreakModeWordWrap];
        #pragma clang diagnostic pop
    } else {
        [controlCenter.label setLineBreakMode:NSLineBreakByWordWrapping];
    }

Objective-C : SYSTEM_VERSION_LESS_THAN()

Swift Objective-C : Swift Objective-C iOS 8

+2

[self presentViewController:loginController animated:YES completion:nil];

[self presentModalViewController:loginController animated:YES];

[self dismissViewControllerAnimated:NO completion:nil];
+1

use thus the following code, it works fine

[self dismissViewControllerAnimated:YES completion:nil];

Tested and working fine.

:)

0
source

Source: https://habr.com/ru/post/1541243/


All Articles