久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

“應用程序試圖以模態方式呈現活動控制器&quo

quot;Application tried to present modally an active controllerquot;?(“應用程序試圖以模態方式呈現活動控制器?)
本文介紹了“應用程序試圖以模態方式呈現活動控制器"?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我剛剛遇到一個崩潰,顯示 NSInvalidArgumentException 并在之前沒有這樣做的應用程序上顯示此消息.

I just came across a crash showing a NSInvalidArgumentException with this message on an app which wasn't doing this before.

應用程序試圖以模態方式呈現一個活動控制器UITabBarController: 0x83d7f00.

Application tried to present modally an active controller UITabBarController: 0x83d7f00.

我有一個 UITabBarController 我在 AppDelegate 中創建并給它一個 UIViewControllers 數組.

I have a UITabBarController which I create in the AppDelegate and give it the array of UIViewControllers.

其中一個我想在點擊它時以模態方式呈現.我通過實現委托方法做到了這一點

One of them I want to present modally when tapped on it. I did that by implementing the delegate method

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

如果該視圖控制器屬于我要以模態方式呈現的視圖控制器,則返回 NO 并執行

If that view controller is of the class of the one I want to present modally, I return NO and do

[tabBarController presentModalViewController:viewController animated:YES];

現在我得到了那個錯誤,這似乎意味著你不能以模態方式呈現一個在其他地方(在標簽欄......)處于活動狀態的視圖控制器我應該說我在 XCode 4.2 Developer Preview 7 上,所以這是 iOS 5(我知道 NDA,但我認為我沒有提供任何禁止的細節).我目前沒有安裝 XCode 來測試針對 iOS4 SDK 編譯是否會崩潰,但我幾乎完全可以肯定它不會.

And now I'm getting that error, which seems to mean that you can't present modally a view controller that is active somewhere else (in the tabbar...) I should say I'm on XCode 4.2 Developer Preview 7, so this is iOS 5 (I know about the NDA, but I think I'm not giving any forbidden details). I currently don't have an XCode installation to test if this crashes compiling against the iOS4 SDK, but I'm almost entirely sure it doesn't.

我只想問有沒有人遇到過這個問題或者有什么建議

I only wanted to ask if anyone has experienced this issue or has any suggestion

推薦答案

假設你有三個視圖控制器實例化如下:

Assume you have three view controllers instantiated like so:

UIViewController* vc1 = [[UIViewController alloc] init];
UIViewController* vc2 = [[UIViewController alloc] init];
UIViewController* vc3 = [[UIViewController alloc] init];

您已將它們添加到這樣的標簽欄:

You have added them to a tab bar like this:

UITabBarController* tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:vc1, vc2, vc3, nil]];

現在你正在嘗試做這樣的事情:

Now you are trying to do something like this:

[tabBarController presentModalViewController:vc3];

這會給你一個錯誤,因為選項卡欄控制器對你給它的視圖控制器有一個死鎖.您可以不將其添加到選項卡欄上的視圖控制器數組中,也可以不以模態方式呈現.

This will give you an error because that Tab Bar Controller has a death grip on the view controller that you gave it. You can either not add it to the array of view controllers on the tab bar, or you can not present it modally.

Apple 希望您以某種方式對待他們的 UI 元素.這可能隱藏在人機界面指南中的某個地方,即不要這樣做,因為我們不希望您這樣做".

Apple expects you to treat their UI elements in a certain way. This is probably buried in the Human Interface Guidelines somewhere as a "don't do this because we aren't expecting you to ever want to do this".

這篇關于“應用程序試圖以模態方式呈現活動控制器"?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using Instruments to test an iOS app without having source code to the application(在沒有應用程序源代碼的情況下使用 Instruments 測試 iOS 應用程序)
KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自動運行/壓力測試 iOS 應用程序以找出罕見 UI 錯誤的原因?)
Can#39;t change target membership visibility in Xcode 4.5(無法更改 Xcode 4.5 中的目標成員身份可見性)
UITableView: Handle cell selection in a mixed cell table view static and dynamic cells(UITableView:在混合單元格表視圖靜態和動態單元格中處理單元格選擇)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中刪除 Safari 中的地址欄?)
iOS 5 SDK is gone after upgrade to Xcode 4.5(升級到 Xcode 4.5 后,iOS 5 SDK 消失了)
主站蜘蛛池模板: 国产精品久久久精品 | 久久亚洲视频 | 亚洲欧美成人在线 | 亚洲综合日韩精品欧美综合区 | 在线欧美视频 | 欧美自拍视频 | 毛片在线视频 | 中文字幕男人的天堂 | 青青操av | 免费能直接在线观看黄的视频 | 成人在线视频一区 | 性色在线 | 人人擦人人干 | 久久久精品视频一区二区三区 | 亚洲成人精品在线观看 | 国产精品一区一区 | 99国产精品99久久久久久 | 91嫩草精品 | av免费在线观看网站 | 亚洲免费一区二区 | 久久久国产精品 | 国产黄色大片在线免费观看 | 精品国产欧美一区二区三区成人 | 欧美一区二区视频 | 亚洲高清视频在线 | 色综合视频 | 亚洲精品小视频在线观看 | 国产精品毛片久久久久久久 | 午夜私人影院在线观看 | 日韩欧美国产精品综合嫩v 一区中文字幕 | 一区二区三区视频免费观看 | 91免费视频观看 | 欧美视频第三页 | 岛国毛片在线观看 | 成人av网站在线观看 | 天堂va在线 | 亚洲大片一区 | 99在线播放 | 91精品国产自产在线老师啪 | 日韩免费在线 | 久久精品这里精品 |