2014-09-02 132 views
3

在應用程序啓動時[[UIDevice currentDevice]方向]方法沒有返回正確的值。這是一個API測試版bug嗎?還是有一種新的方法來檢測iOS 8中的方向?iOS 8在應用程序啓動時檢測設備方向

下面是在應用程序啓動時使用的確切代碼。

UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation]; 

if (deviceOrientation == UIDeviceOrientationPortrait){ 
} 
else if (deviceOrientation == UIDeviceOrientationLandscapeLeft){ 
    [self orientationLandscapeLeftAdjust]; 
} 
else if (deviceOrientation == UIDeviceOrientationLandscapeRight){ 
    [self orientationLandscapeRightAdjust]; 
} 
else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown){ 
    [self orientationPortraitUpSideDownAdjust]; 
} 

回答

1

事實證明,這是關係到每一個傳遞消息的應用程序在iOS版推出8測試版5.這會強制啓動,在它的默認方向的應用程序時彈出的「無SIM卡」警報的錯誤。我讀到這個bug已經在iOS 8 beta 6中得到了解決,該版本已發佈給運營商和其他測試合作伙伴。

相關問題