2012-04-03 73 views
2

我正在使用SplitViewController和酥料餅,標準的東西應用。它從sdk 3.0開始的10個版本運行良好。它仍然編譯並在Snow Leopard,Xcode 4.2和sdk 5.0的模擬器上正常工作。然而,在Lion上時,Xcode 4.3和SDK 5.1運行時,它拋出錯誤:酥料餅的初始化錯誤5.1

Assertion failure in -[_UISlidingPopoverLayoutInfo _popoverViewSizeForContentSize:arrowDirection:], /SourceCache/UIKit_Sim/UIKit-1914.84/_UIPopoverLayoutInfo.m:160

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown direction passed to _popoverViewSizeForContentSize:arrowDirection:'

酥料餅只是開始作爲類的一部分:

@interface NewsDetailViewController : UIViewController <UIActionSheetDelegate, UISplitViewControllerDelegate, UIWebViewDelegate>{ 

    RssFunAppDelegate * _appDelegate; 
    UITextView * _titleTextView; 
    UINavigationBar * _navigationBar; 
    UIPopoverController * _popContr;  
    UIWebView * _webView; 
    UIActivityIndicatorView * _activityIndicator; 
} 
+1

您所面對的標題代碼與錯誤無關,因此這段代碼無關緊要。將代碼發佈到您調用popover的'@ implementation'中。 – WrightsCS 2012-04-03 06:08:34

+0

是的,您需要在您創建並使用彈出窗口的位置發佈代碼。 – 2012-04-13 22:05:13

回答

0

您需要張貼初始化UIPopoverController代碼得到任何真正的幫助。

雖然從讀異常文本,我會通過調查初始化,看看你是否將其設爲什麼奇怪的地方開始。唯一支持的值是:

UIPopoverArrowDirectionUp 
UIPopoverArrowDirectionDown 
UIPopoverArrowDirectionLeft 
UIPopoverArrowDirectionRight 
UIPopoverArrowDirectionAny 

或這些的按位組合,例如,

UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight 
+0

UIPopoverController從未初始化。所使用的唯一的地方是splitViewController處理,但我懷疑它的相關性: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { \t如果(interfaceOrientation == UIInterfaceOrientationPortrait){ \t \t [_popContr presentPopoverFromBarButtonItem:_navigationBar.topItem .leftBarButtonItem allowedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; \t} \t返回YES; } – Biko 2012-04-03 07:16:59

+0

- (空)splitViewController:(UISplitViewController *)SVC willHideViewController:(UIViewController的*)aViewController withBarButtonItem:(*的UIBarButtonItem)barButtonItem forPopoverController:(UIPopoverController *)PC { \t \t \t barButtonItem.title = NSLocalizedString(@「新聞項目「,@」按鈕標題「); \t [_navigationBar.topItem setLeftBarButtonItem:barButtonItem animated:YES]; \t _popContr = pc; \t \t } – Biko 2012-04-03 07:20:54

+0

- (無效)splitViewController:(UISplitViewController *)SVC willShowViewController:(UIViewController中*)aViewController invalidatingBarButtonItem:(的UIBarButtonItem *)barButtonItem {\t \t \t [_navigationBar.topItem setLeftBarButtonItem:無動畫:YES]; \t _popContr = nil; \t \t } – Biko 2012-04-03 07:21:25