Подтвердить что ты не робот

PresentModalViewController: анимированный устарел

Я получаю предупреждение в XCode:

'presentModalViewController:animated:' is deprecated: first deprecated in iOS 6.0

в этой строке кода:

[self presentModalViewController:initialSettingsVC animated:YES];

Я попытался заменить его, как было предложено в documentation, с помощью:

[self presentModalViewController:initialSettingsVC animated:YES completion:nil];

Теперь я получаю сообщение об ошибке в XCode:

Нет видимого @interface для 'ViewController' объявляет селектор 'PresentModalViewController: анимированные: завершение:'

Любые идеи?

4b9b3361

Ответ 1

Использовать следующее........

if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
    [self presentViewController:test animated:YES completion:nil];
} else {
    [self presentModalViewController:test animated:YES];
}

я нашел здесь

Ответ 2

Заменить

[self presentModalViewController:initialSettingsVC animated:YES completion:nil];

To

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

Ответ 3

Вы хотите использовать следующие

- (void)presentViewController:(UIViewController *)viewControllerToPresent 
                      animated: (BOOL)flag completion:(void (^)(void))completion;

установка UIModalPresentationStyle и UIModalTransitionStyle для viewController для получения модальной анимации/презентации, которую вы ищете