[英]iOS 7 Landscape only app can't access photo library
我有一個僅限風景的應用程序,每當我訪問照片庫時,該應用程序都會崩潰(因為UIImagePickerViewController
試圖以縱向模式加載)。 該應用程序在iOS 5
和6
運行良好。
由於未捕獲的異常'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
不幸的是,似乎UIImagePickerViewController將僅在縱向模式下工作。 我發現解決此問題的唯一方法是向縱向列表中的應用程序添加肖像模式支持,但將所有其他視圖限制為僅支持橫向。
在您想要的所有縱向視圖中添加以下內容:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.