草庐IT

IOS 我得到了 [UIWindow Controller transition :fromViewController:toViewController:target:didEndSelector:] error

coder 2024-01-15 原文

错误不是每次都有。 我曾尝试清理和重建应用程序,但它也是。

错误:

 *** Assertion failure in -[UIWindowController 
    transition:fromViewController:toViewController:target:didEndSelector:], 
   /SourceCache/UIKit_Sim/UIKit-2372/UIWindowController.m:211

 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
     reason: 'Attempting to begin a modal transition from 
     <UINavigationController: 0x9190730> to <UINavigationController: 0x83a9dc0> 
     while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear
     to know the current transition has completed'

 *** First throw call stack:
 (0x213d012 0x1e85e7e 0x213ce78 0x191bf35 0x10b8d05 0xeb74f3 0xeb7777 0x10be033f   
  0xeb77b7 0x104f0 0x1e996b0 0x18c6035 0x20c0f3f 0x20c096f 0x20e3734 0x20e2f44 
  0x20e2e1b 0x36437e3 0x3643668 0xdcd65c 0x1133f2 0x25c5)
  libc++abi.dylib: terminate called throwing an exception

基础 Controller .h:

 @class LoginViewController;
 @interface BaseController:UIViewController
 //...
 @end

BaseController.m

 @implement BaseController
 //...
 -(void)showLoginForm
 {
    UIViewController* loginx =(UIViewController*) [[LoginViewController alloc] init];
    UINavigationController* navx = [[UINavigationController alloc] initWithRootViewController:loginx];
    [navx.navigationBar setBackgroundImage:[UIImage imageNamed:@"title_bar.png"] forBarMetrics:UIBarMetricsDefault];
    //added
    //i can use @try to catch it       
    [self presentModalViewController:navx animated:YES];//<====it is error

    [loginx release];
    [navx release];
 }

登录 View Controller :

 @interface LoginViewController:BaseController
 //...
 @end

其他 View Controller : 我将在这个 Controller 中判断用户是否登录。如果不是登录,我将调用 showLoginForm

  //@interface otherViewController:BaseController
  //......
 -(void)viewDidLoad
  {
     //make a thread to call isLogin
  }
 -(void)isLogin
  { 
      BOOL logined = YES;
      //......
      if(!logined)//i take this on MainThread,it has error also.
         [super showLoginForm];
  }

MainViewController:(显示其他ViewController的是Main ViewController)

 //@interface MainViewController:BaseController
  //......

 -(void)buttonAction
 {
     otherViewController* other = [[otherViewController alloc] init];
     UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:other];
      [self presentModalViewController:navigation animated:YES];
     //release
  }

所以,谁知道这是怎么回事?

最佳答案

在otherViewController.m中你应该将调用isLogin方法的代码移到

- (void)viewDidAppear:(BOOL)animated

这将确保当 [self presentModalViewController:navx animated:YES]; 被调用时,otherViewController 的呈现转换将完成。

关于IOS 我得到了 [UIWindow Controller transition :fromViewController:toViewController:target:didEndSelector:] error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13321203/

有关IOS 我得到了 [UIWindow Controller transition :fromViewController:toViewController:target:didEndSelector:] error的更多相关文章

  1. ruby-on-rails - Ruby on Rails : . 常量化 : wrong constant name error? - 2

    我正在使用这个:4.times{|i|assert_not_equal("content#{i+2}".constantize,object.first_content)}我之前声明过局部变量content1content2content3content4content5我得到的错误NameError:wrongconstantnamecontent2这个错误是什么意思?我很确定我想要content2=\ 最佳答案 你必须用一个大字母来调用ruby​​常量:Content2而不是content2。Aconstantnamestart

  2. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  3. ruby - RVM "ERROR: Unable to checkout branch ."单用户 - 2

    我在新的Debian6VirtualBoxVM上安装RVM时遇到问题。我已经安装了所有需要的包并使用下载了安装脚本(curl-shttps://rvm.beginrescueend.com/install/rvm)>rvm,但以单个用户身份运行时bashrvm我收到以下错误消息:ERROR:Unabletocheckoutbranch.安装在这里停止,并且(据我所知)没有安装RVM的任何文件。如果我以root身份运行脚本(对于多用户安装),我会收到另一条消息:Successfullycheckedoutbranch''安装程序继续并指示成功,但未添加.rvm目录,甚至在修改我的.bas

  4. Matlab imread()读到了什么 (浅显 当复习文档了) - 2

    matlab打开matlab,用最简单的imread方法读取一个图像clcclearimg_h=imread('hua.jpg');返回一个数组(矩阵),往往是a*b*cunit8类型解释一下这个三维数组的意思,行数、数和层数,unit8:指数据类型,无符号八位整形,可理解为0~2^8的数三个层数分别代表RGB三个通道图像rgb最常用的是24-位实现方法,即RGB每个通道有256色阶(2^8)。基于这样的24-位RGB模型的色彩空间可以表现256×256×256≈1670万色当imshow传入了一个二维数组,它将以灰度方式绘制;可以把图像拆分为rgb三层,可以以灰度的方式观察它figure(1

  5. ruby-on-rails - 尝试设置 Amazon 的 S3 存储桶 : 403 Forbidden error & setting permissions - 2

    我正在关注Hartl的railstutorial.org并已到达11.4.4:Imageuploadinproduction.我做了什么:注册亚马逊网络服务在AmazonIdentityandAccessManagement中,我创建了一个用户。用户创建成功。在AmazonS3中,我创建了一个新存储桶。设置新存储桶的权限:权限:本教程指示“授予上一步创建的用户读写权限”。但是,在存储桶的“权限”下,未提及新用户名。我只能在每个人、经过身份验证的用户、日志传送、我和亚马逊似乎根据我的名字+数字创建的用户名之间进行选择。我已经通过选择经过身份验证的用户并选中了上传/删除和查看权限的框(而不

  6. ruby-on-rails - 冒号(:) gives load error in locale YAML file - 2

    我在en:语言环境中有一个字符串display_device:toplay:getplayer冒号给我的错误是cannotloadtranslationsfromC:/DocumentsandSettings/rajg/discoveryaws/branches/internationalization/config/locales/en.yml,expectedittoreturnahash,butdoesnot我怎样才能让它工作? 最佳答案 如果你用这样的引号将它括起来,你可以在你的字符串中转义冒号(和其他“重要”字符):dis

  7. ruby - gem install pg error : couldn't understand kern. osversion `14.0.0' on Yosemite w/Ruby 2.1.5 - 2

    我使用RVM安装Ruby-2.1.5并再次运行bundle。现在pggem不会安装,我得到这个错误:geminstallpg-v'0.17.1'----with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_configBuildingnativeextensionswith:'--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config'Thiscouldtakeawhile...ERROR:Error

  8. ruby-on-rails - 32651 :ERROR comparison of Float with Float failed ruby - 2

    我是Rails的新手,我遇到了一个错误,但我似乎找不到问题所在。这是日志:[32651:ERROR]2012-10-0913:46:52::comparisonofFloatwithFloatfailed[32651:ERROR]2012-10-0913:46:52::/home/sunny/backend/lib/analytics/lifetime.rb:45:in`each'/home/sunny/backend/lib/analytics/lifetime.rb:45:in`max'/home/sunny/backend/lib/analytics/lifetime.rb:45

  9. ruby - rspec: raise_error 用法来匹配错误信息 - 2

    我使用raise(ConfigurationError.new(msg))引发错误我试着用rspec测试一下:expect{Base.configuration.username}.toraise_error(ConfigurationError,message)但这行不通。我该如何测试呢?目标是匹配message。 最佳答案 您可以使用正则表达式匹配错误消息:it{expect{Foo.bar}.toraise_error(NoMethodError,/private/)}这将检查NoMethodError是否由privateme

  10. 【RuntimeError: CUDA error: device-side assert triggered】问题与解决 - 2

    RuntimeError:CUDAerror:device-sideasserttriggered问题描述解决思路发现问题:总结问题描述当我在调试模型的时候,出现了如下的问题/opt/conda/conda-bld/pytorch_1656352465323/work/aten/src/ATen/native/cuda/IndexKernel.cu:91:operator():block:[5,0,0],thread:[63,0,0]Assertion`index>=-sizes[i]&&index通过提示信息可以知道是个数组越界的问题。但是如图一中第二行话所说这个问题可能并不出在提示的代码段

随机推荐