• <bdo id='rlkM4'></bdo><ul id='rlkM4'></ul>
      1. <small id='rlkM4'></small><noframes id='rlkM4'>

        <legend id='rlkM4'><style id='rlkM4'><dir id='rlkM4'><q id='rlkM4'></q></dir></style></legend><tfoot id='rlkM4'></tfoot>

      2. <i id='rlkM4'><tr id='rlkM4'><dt id='rlkM4'><q id='rlkM4'><span id='rlkM4'><b id='rlkM4'><form id='rlkM4'><ins id='rlkM4'></ins><ul id='rlkM4'></ul><sub id='rlkM4'></sub></form><legend id='rlkM4'></legend><bdo id='rlkM4'><pre id='rlkM4'><center id='rlkM4'></center></pre></bdo></b><th id='rlkM4'></th></span></q></dt></tr></i><div id='rlkM4'><tfoot id='rlkM4'></tfoot><dl id='rlkM4'><fieldset id='rlkM4'></fieldset></dl></div>
      3. dismissModalViewControllerAnimated:(和dismissViewControllerA

        时间:2023-05-30

        1. <i id='uEpOn'><tr id='uEpOn'><dt id='uEpOn'><q id='uEpOn'><span id='uEpOn'><b id='uEpOn'><form id='uEpOn'><ins id='uEpOn'></ins><ul id='uEpOn'></ul><sub id='uEpOn'></sub></form><legend id='uEpOn'></legend><bdo id='uEpOn'><pre id='uEpOn'><center id='uEpOn'></center></pre></bdo></b><th id='uEpOn'></th></span></q></dt></tr></i><div id='uEpOn'><tfoot id='uEpOn'></tfoot><dl id='uEpOn'><fieldset id='uEpOn'></fieldset></dl></div>
            <tbody id='uEpOn'></tbody>

            <small id='uEpOn'></small><noframes id='uEpOn'>

              <tfoot id='uEpOn'></tfoot>
                <bdo id='uEpOn'></bdo><ul id='uEpOn'></ul>
                1. <legend id='uEpOn'><style id='uEpOn'><dir id='uEpOn'><q id='uEpOn'></q></dir></style></legend>

                  本文介绍了dismissModalViewControllerAnimated:(和dismissViewControllerAnimated)在iOS 5中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我找不到任何合乎逻辑的解释,但事实仍然是,在 iOS 5 (xCode 4.2) 中,如果我 presentModalView:* animated:YES,我可以调用dismissModalViewAnimated:* 很好,但如果我调用 presentModalView:*动画:否,然后调用解除方法崩溃.(如果我使用新的 presentViewController:animated:completion:+dismissViewControllerAnimated:),这同样适用.我现在要尝试解决这个问题(我不希望演示文稿动画化)并向Apple报告一个错误,但我一直在努力解决这个问题.欢迎任何和所有建议.iOS 5 上没有多少,所以如果可以,请提供帮助.在 iOS 4 或 iOS 5 中不会崩溃的示例代码:

                  I can't find any logical explanation, but the fact remains that, in iOS 5 (xCode 4.2), if I presentModalView:* animated:YES, I can call dismissModalViewAnimated:* fine, but if I call presentModalView:* animated:NO, then calling the dismiss method crashes. (This works the same if I use the new presentViewController:animated:completion: + dismissViewControllerAnimated:). I am going TRY to work around this for now (I don't want the presentation animated) and report a bug to Apple, but I have been beating my head on this for a while. Any and all suggestions are welcome. Not much out there on iOS 5, so please help if you can. Sample code that does not crash in iOS 4 or iOS 5:

                  LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
                  [self presentModalViewController:loginController animated:YES];
                  [loginController release];
                  ...
                  [self dismissModalViewControllerAnimated:YES];
                  

                  这将在 iOS 5 中崩溃,并在解除调用时出现 EXC_BAD_ACCESS:

                  This will crash in iOS 5 with EXC_BAD_ACCESS on the dismiss call:

                  LoginController *loginController = [[LoginController alloc]    initWithNibName:@"LoginControllerGG" bundle:nil];
                  [self presentModalViewController:loginController animated:NO];
                  [loginController release];
                  ...
                  [self dismissModalViewControllerAnimated:YES]; //crashes with EXC_BAD _ACCESS
                  

                  注意:我在 loginController 中有一个动画,它发生在 viewDidLoad 上.去看看把它拿出来是否会改变任何东西,但我想把它拿出来,因为我需要尽快找到解决方案.

                  One note: I have an animation within the loginController that happens on viewDidLoad. Going to see if taking that out changes anything, but I wanted to get this out there since I need a solution asap.

                  完整代码流程...在 AppDelegate 中,application:didFinishLaunchingWithOptions:

                  Full code flow... In AppDelegate, application:didFinishLaunchingWithOptions:

                  if (!loggedIn)  [myViewController showLoginPanel];
                  

                  在 myViewController 中:

                  In myViewController:

                  - (void)showLoginPanel {    
                      LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
                      if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]) {
                          [self presentViewController:loginController animated:NO completion:nil];
                      } else {
                          [self presentModalViewController:loginController animated:NO]; //iOS 4 works fine with or without animation   
                      } 
                      [loginController release];  
                  }
                  

                  在登录控制器中:

                  - (IBAction)closeLoginWindow {
                      [[NSNotificationCenter defaultCenter] postNotificationName:@"CloseLoginWindow" object:nil];
                  }   //doing it this way because calling on the self.parentViewController doesn't work
                  

                  返回 myViewController:

                  Back in myViewController:

                  - (void) viewDidLoad
                      ...
                  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeLoginWindow) name:@"CloseLoginWindow" object:nil];
                      ...
                  
                  - (void)closeLoginWindow {
                      if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
                          [self dismissViewControllerAnimated:YES completion:nil];    //iOS 5 crashes only if presentation was not animated
                      } else [self dismissModalViewControllerAnimated:YES];    //deleting the previous condition, iOS 5 still crashes if presentation was not animated
                  }    
                  

                  推荐答案

                  在 iOS5 中,生命周期的管理发生了某种变化,我无法详细解释这个问题.无论如何,解决方法是将工作流从 applicationDidFinishLaunchingWithOptions 推迟到 applicationDidBecomeActive.似乎在调用 applicationDidFinishLaunchingWithOptions 时没有正确初始化某些内容.

                  In iOS5 the managing of the lifecyle somehow changed and I cannot explain that issue in detail. Anyway, the fix is to postpone that workflow from applicationDidFinishLaunchingWithOptions to applicationDidBecomeActive. It seems that something isn't initialized right at the call of applicationDidFinishLaunchingWithOptions.

                  - (void)applicationDidFinishLaunchingWithOptions:... {    
                      // in order to do this only at launching, but not on every activation 
                      // Declaration as property for example
                      applicationDidLaunch = YES;
                  }
                  
                  - (void) applicationDidBecomeActive:(UIApplication *)application {
                      if (applicationDidLaunch) {
                          applicationDidLaunch = NO;
                          [Start your login Workflow with modal view presenting here]
                      }
                  }
                  

                  很好奇你的反馈:)....

                  Curious to ur feedback :)....

                  这篇关于dismissModalViewControllerAnimated:(和dismissViewControllerAnimated)在iOS 5中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何禁用水平拖动?(webkit-overflow-scrolling:触摸; 下一篇:当 hidesBottomBarWhenPushed 为“TRUE"时如何隐藏自

                  相关文章

                  最新文章

                  <tfoot id='RBJMo'></tfoot>
                    <bdo id='RBJMo'></bdo><ul id='RBJMo'></ul>
                    <i id='RBJMo'><tr id='RBJMo'><dt id='RBJMo'><q id='RBJMo'><span id='RBJMo'><b id='RBJMo'><form id='RBJMo'><ins id='RBJMo'></ins><ul id='RBJMo'></ul><sub id='RBJMo'></sub></form><legend id='RBJMo'></legend><bdo id='RBJMo'><pre id='RBJMo'><center id='RBJMo'></center></pre></bdo></b><th id='RBJMo'></th></span></q></dt></tr></i><div id='RBJMo'><tfoot id='RBJMo'></tfoot><dl id='RBJMo'><fieldset id='RBJMo'></fieldset></dl></div>
                    1. <legend id='RBJMo'><style id='RBJMo'><dir id='RBJMo'><q id='RBJMo'></q></dir></style></legend>

                      <small id='RBJMo'></small><noframes id='RBJMo'>