2017-10-17 6 views
-3

私はiOSとObjective-cにはかなり新しく、xcodeからこの警告を受け取りました。IOSで廃止されたコード8

willRotateToInterfaceも動作していません。私はここで他の質問もチェックしましたが、それを適用するのと同じ方法しかありません。

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) 
{ 
    UIUserNotificationSettings *settings = 
    [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | 
    UIUserNotificationTypeBadge | 
    UIUserNotificationTypeSound 
             categories:nil]; 
    [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; 
    [[UIApplication sharedApplication] registerForRemoteNotifications]; 
} 
else 
{ 
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 
    UIRemoteNotificationTypeAlert | 
    UIRemoteNotificationTypeBadge | 
    UIRemoteNotificationTypeSound]; 
} 

私は警告registerForRemoteNotificationTypesを得た:」廃止されました:最初のiOS 8.0で非推奨 - 利用 - [のUIApplication registerForRemoteNotifications]とUserNotifications Frameworkの - [UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]

+2

黄色の背景メッセージは、あなたに何をする必要があるかをすでに伝えています。メソッドを新しいものに置き換えてください。 –

+0

@YunCHENええ、私は私がかなり慣れているので、私はそれを置くべきであることを正確にはわかりません。 – codeninja

+0

'control' +' command'を押して、メソッドをクリックすると、.hファイルに入りますメソッド宣言。その詳細は、.hファイルを参照してください。 –

答えて

1

親切に以下のメソッドを実装

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator 
{ 
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) 
    { 
     //..... Your code here 
    } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) 
    { 

    }]; 

    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; 
} 
関連する問題