2013-06-11 30 views
11

Dostaję ostrzeżenie w Xcode:presentModalViewController: animowane jest przestarzała

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

na tej linii kodu:

[self presentModalViewController:initialSettingsVC animated:YES]; 

starałem się go zastąpić, jak sugerowano w documentation z:

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

Teraz pojawia się błąd w kodzie X:

Brak widocznych @interface dla 'ViewController' deklaruje selektor 'presentModalViewController: animowany: Zakończenie:'

Jakieś pomysły?

+1

Ty błędnie metodę. To jest 'presentViewController: animated: completion'. Usuń "Modal". – bbarnhart

+0

@bbarnhart Masz rację. To jest rozwiązanie. – poiuytrez

Odpowiedz

4

Chcesz użyć następujących

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

settting UIModalPresentationStyle i UIModalTransitionStyle dla viewController w celu uzyskania modalne animacji/prezentacji szukasz

12

używać następujących ....... .

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

znalazłem Here

5

Wymień

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

Aby

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

Od wersji ios 10 nie będzie to prezentacja modalna. –

Powiązane problemy