2013-10-10 38 views
0

我有一個橫向唯一的應用程序,每當我訪問照片庫時,應用程序將崩潰(因爲UIImagePickerViewController正試圖在縱向模式下加載)。應用程序在iOS 56中正常工作。iOS 7只有橫向應用程序無法訪問照片庫

終止應用程序由於未捕獲的異常'UIApplicationInvalidInterfaceOrientation',原因是:「支持的方向與應用程序中沒有共同的方向,並shouldAutorotate將返回YES」

*** First throw call stack: 
(
    0 CoreFoundation      0x0303c5e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x024028b6 objc_exception_throw + 44 
    2 CoreFoundation      0x0303c3bb +[NSException raise:format:] + 139 
    3 UIKit        0x0108b7b2 -[UIViewController __supportedInterfaceOrientations] + 509 
    4 UIKit        0x0108b7de -[UIViewController __withSupportedInterfaceOrientation:apply:] + 34 
    5 UIKit        0x0108be52 -[UIViewController setInterfaceOrientation:] + 139 
    6 UIKit        0x01080ca8 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 946 
    7 UIKit        0x00fcdb48 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1530 
    8 UIKit        0x00fcd847 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 761 
    9 UIKit        0x00fc5070 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 162 
    10 UIKit        0x00fc4ef8 -[UIView(Hierarchy) _postMovedFromSuperview:] + 260 
    11 UIKit        0x00fd0031 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847 
    12 UIKit        0x00fc3521 -[UIView(Hierarchy) addSubview:] + 56 
    13 UIKit        0x0128cc3f -[UINavigationTransitionView transition:fromView:toView:] + 501 
    14 UIKit        0x0128ca42 -[UINavigationTransitionView transition:toView:] + 55 
    15 UIKit        0x010a23d7 -[UINavigationController _startTransition:fromViewController:toViewController:] + 3186 
    16 UIKit        0x010a272c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645 
    17 UIKit        0x010a3349 -[UINavigationController __viewWillLayoutSubviews] + 57 
    18 UIKit        0x011dc39d -[UILayoutContainerView layoutSubviews] + 213 
    19 UIKit        0x00fd2dd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 
    20 libobjc.A.dylib      0x0241481f -[NSObject performSelector:withObject:] + 70 
    21 QuartzCore       0x00d6872a -[CALayer layoutSublayers] + 148 
    22 QuartzCore       0x00d5c514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    23 QuartzCore       0x00d5c380 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 
    24 QuartzCore       0x00cc4156 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 
    25 QuartzCore       0x00cc54e1 _ZN2CA11Transaction6commitEv + 393 
    26 QuartzCore       0x00cc5bb4 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 
    27 CoreFoundation      0x0300453e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 
    28 CoreFoundation      0x0300448f __CFRunLoopDoObservers + 399 
    29 CoreFoundation      0x02fe23b4 __CFRunLoopRun + 1076 
    30 CoreFoundation      0x02fe1b33 CFRunLoopRunSpecific + 467 
    31 CoreFoundation      0x02fe194b CFRunLoopRunInMode + 123 
    32 GraphicsServices     0x032969d7 GSEventRunModal + 192 
    33 GraphicsServices     0x032967fe GSEventRun + 104 
    34 UIKit        0x00f6894b UIApplicationMain + 1225 
    35 Kickass        0x000027ad main + 141 
    36 Kickass        0x00002715 start + 53 
    37 ???         0x00000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+0

[iOS的7只景觀應用的可能重複無法訪問照片圖書館](http://stackoverflow.com/questions/18998607/ios-7-landscape-only-app-cant-access-photo-library) –

+0

我已經檢查了這個,但應用程序也旋轉到肖像在iOS 7 – vanitha

+0

iOS 7橫向模式訪問庫,但它也旋轉到縱向。 – vanitha

回答

0

遺憾的是,似乎UIImagePickerViewController將只在縱向模式下工作。 我發現解決這個問題的唯一方法是將肖像模式支持添加到plist中的應用程序,但將所有其他視圖限制爲僅支持格局。

下面添加到您不希望您的所有意見肖像:

- (NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

信用爲這個答案去 iOS 7 Landscape only app can't access photo library

相關問題