久久久久久久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 消失了)
主站蜘蛛池模板: 成人美女免费网站视频 | 国产精品入口麻豆www | 一二三区av | 81精品国产乱码久久久久久 | 春色av| 久久综合九色综合欧美狠狠 | 欧美成人手机在线 | 色资源在线 | 性视频网 | 国产ts人妖系列高潮 | 在线看成人av| 亚洲激情自拍偷拍 | 日韩国产欧美 | 久久精品欧美一区二区三区不卡 | 日本超碰 | 国产二区三区 | 国产日韩久久 | 黄色成人免费看 | 国产自产21区 | 青青草视频网站 | 欧美日韩亚洲国产综合 | 国产精品免费一区二区 | 婷婷丁香在线视频 | 偷派自拍 | 91高清免费观看 | 久久国产高清 | 日韩一区二区三区视频 | 欧美在线不卡 | 亚洲国产高清在线 | 国产成人精品a视频一区www | 九九热国产精品视频 | 亚洲精品一区二区三区蜜桃久 | 国产精品女人久久久 | 国产精品久久久久久久久久三级 | 中国黄色在线视频 | 日本视频在线 | 国产99久久精品一区二区永久免费 | 午夜天堂精品久久久久 | 色爱综合网 | 一区二区三区在线播放视频 | 日韩一区二区三区在线视频 |