Llamadas desequilibradas para iniciar / finalizar transiciones de apariencia para


Lo leí acerca de otro usuario que encuentra un error similar, pero este error es en un caso diferente.

Recibí este mensaje cuando agregué un Controlador de Vista inicialmente:

Unbalanced calls to begin/end appearance transitions for 
<UITabBarController: 0x197870>

La estructura de la aplicación es la siguiente:

Tengo un TabBarController de 5 pestañas vinculado a 5 Controladores de vista. En la pestaña de visualización inicial, llamo a un nuevo Controlador de vista para superponer como una introducción de la aplicación.

Utilizo este código para llamar a la vista de introducción controlador:

IntroVC *vc = [[IntroVC alloc] init];
[self presentModalViewController:vc animated:YES];
[vc release]; 

Después de que este IntroVC controlador de vista aparece, se muestra el error anterior.

P. S. Estoy usando xCode 4.2 y iOS 5.0 SDK, desarrollando iOS 4.3 aplicación.

Author: Community, 2011-10-25

20 answers

Sin ver más del código circundante no puedo dar una respuesta definitiva, pero tengo dos teorías.

  1. No estás usando el inicializador designado de UIViewController initWithNibName:bundle:. Intente usarlo en lugar de solo init.

  2. También, self puede ser uno de los controladores de vista del controlador de barra de pestañas. Presente siempre los controladores de vista desde el controlador de vista superior, lo que significa que en este caso pida al controlador de la barra de pestañas que presente el controlador de vista superpuesto en nombre del controlador de vista. Aún puede mantener cualquier delegado de devolución de llamada en el controlador de vista real, pero debe tener presente el controlador de barra de pestañas y descartar.

 90
Author: Jesper,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-24 02:16:47

Solucioné este error cambiando la animación de SÍ a NO.

De:

[tabBarController presentModalViewController:viewController animated:YES];

A:

[tabBarController presentModalViewController:viewController animated:NO];
 38
Author: PokerIncome.com,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-01 19:35:37

Según lo publicado por danh

Puede generar esta advertencia presentando el vc modal antes de que la aplicación termine de inicializar. es decir, Iniciar una aplicación de plantilla de aplicación con pestañas y presentar un vc modal en la parte superior de uno mismo.TabBarController como la última línea en la aplicación:didFinishLaunching. Aparece una advertencia. Solución: deje que la pila se desenrolle primero, presente el vc modal en otro método, invocado con un performSelector withDelay:0.0

Intente mover el método a la viewWillAppear y guardia para que se ejecute sólo una vez (recomiendo la configuración de una propiedad)

 14
Author: Peter Lapisu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 10:31:15

Tuve el mismo problema cuando necesito presentar Mi Controlador de Vista de Inicio de Sesión desde otro Controlador de Vista Si el Usuario no está autorizado, lo hice en el método viewDidLoad de mi Otro Controlador de Vista ( si no está autorizado -> presentModalViewController ). Cuando empiezo a hacerlo en el método viewDidAppear, resolví este problema. ¡Creo que viewDidLoad solo inicializa las propiedades y después comienza el algoritmo de visualización real! Es por eso que debe usar el método viewDidAppear para hacer modal transiciones!

 3
Author: Tolusha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-08 13:15:14

Yo tenía el mismo problema. Llamé a un método inside viewDidLoad dentro de mi primer UIViewController

- (void)viewDidLoad{
    [self performSelector:@selector(loadingView)
               withObject:nil afterDelay:0.5];
}

- (void)loadingView{

    [self performSegueWithIdentifier:@"loadedData" sender:self];
}

Dentro del segundo UIViewController hice lo mismo también con 0,5 segundos de retraso. Después de cambiar el retardo a un valor más alto, funcionó bien. Es como si el segue no se pudiera realizar demasiado rápido después de otro segue.

 3
Author: Alex Cio,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-02 16:58:00

Tuve muchos problemas con el mismo problema. Resolví este por

  1. Iniciando el ViewController usando el método storyboad Instantiateviewcontroller conidentifier. es decir, Intro *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"introVC"];
  2. [self.tabBarController presentModalViewController : vc animated:YES];

Tengo el viewcontroller en mi storyboard, por alguna razón usar solo [[introvc alloc] init]; no funcionó para mí.

 2
Author: Mogambolal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-23 07:13:33

Lo resolví escribiendo

[self.navigationController presentViewController:viewController 
                                        animated:TRUE 
                                      completion:NULL];
 2
Author: pankesh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-03 14:02:48

Otra solución para muchos casos es asegurarse de que la transición entre UIViewControllers sucede después de que finalice el procedimiento no adecuado (como durante la inicialización), haciendo:

__weak MyViewController *weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
    [weakSelf presentViewController:vc animated:YES];
});

Esto es general también para pushViewController:animated:, etc.

 2
Author: mllm,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-09 09:20:55

Tuve el mismo error. Tengo una barra de pestañas con 3 elementos e inconscientemente intentaba llamar al controlador de vista raíz del elemento 1 en el elemento 2 de mi barra de pestañas usando performSegueWithIdentifier.

Lo que sucede es que llama al controlador de vista y vuelve al controlador de vista raíz del elemento 2 después de unos segundos y registra ese error.

Aparentemente, no se puede llamar al controlador de vista raíz de un elemento a otro elemento.

Así que en lugar de performSegueWithIdentifier

He utilizado [self.parentViewController.tabBarController setSelectedIndex:0];

Espero que esto ayuda a alguien.

 1
Author: Gellie Ann,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-03 01:14:48

Tuve el mismo problema y pensé que publicaría en caso de que alguien más se encuentre con algo similar.

En mi caso, había adjuntado un reconocedor de gestos de pulsación larga a mi UITableViewController.

UILongPressGestureRecognizer *longPressGesture = [[[UILongPressGestureRecognizer alloc]
                                                   initWithTarget:self
                                                   action:@selector(onLongPress:)]
                                                  autorelease];
[longPressGesture setMinimumPressDuration:1];
[self.tableView addGestureRecognizer:longPressGesture];

En mi selector onLongPress, lancé mi siguiente controlador de vista.

- (IBAction)onLongPress:(id)sender {

    SomeViewController* page = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:nil];

    [self.navigationController pushViewController:page animated:YES];

    [page release];

}

En mi caso, recibí el mensaje de error porque el recognizer de pulsaciones largas se disparó más de una vez y como resultado, mi "SomeViewController" fue empujado a la pila varias veces.

La solución fue agregar un booleano para indicar cuando SomeViewController había sido empujado a la pila. Cuando se llamó al método viewWillAppear de mi UITableViewController, puse el booleano de nuevo a NO.

 1
Author: Dale Moore,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-15 01:02:41

Tuve este problema con un código de terceros. Alguien olvidó configurar el super dentro de viewWillAppear y viewWillDisappear en una clase TabBarController personalizada.

- (void) viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];
    // code...
}

or

- (void) viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:animated];
    // code...
}
 1
Author: J. Lopes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-29 11:36:48

En Swift 2+ para mí funciona:

Tengo UITabBarViewController en storyboard y había seleccionado la propiedad Index como esta:

introduzca la descripción de la imagen aquí

Pero lo borro, y añado en mi método viewDidLoad de mi clase inicial, así:

override func viewDidLoad() {
   super.viewDidLoad()
   self.tabBarController?.selectedIndex = 2
}

Espero poder ayudar a alguien.

 1
Author: Dasoga,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-08 05:49:31

Si está utilizando transitioningDelegate (no es el caso en el ejemplo de esta pregunta), también establezca modalPresentationStyle to .Custom.

Swift

let vc = storyboard.instantiateViewControllerWithIdentifier("...")
vc.transitioningDelegate = self
vc.modalPresentationStyle = .Custom
 1
Author: Kof,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-31 08:59:50

Tuve este problema debido a un error tipográfico:

override func viewDidAppear(animated: Bool) {
    super.viewWillAppear(animated)

En lugar de

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

Estaba llamando " WillAppear "en el super en lugar de"DidAppear"

 1
Author: Adriano Spadoni,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-13 19:48:18

En realidad, debe esperar hasta que finalice la animación push. Así que puede delegar UINavigationController y evitar empujar hasta que termine la animación.

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
    waitNavigation = NO;
}


-(void)showGScreen:(id)gvc{

    if (!waitNavigation) {
        waitNavigation = YES;
        [_nav popToRootViewControllerAnimated:NO];
        [_nav pushViewController:gvc animated:YES];
    }
}
 0
Author: ymutlu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-22 11:40:58

Como @danh sugirió, mi problema era que estaba presentando el cv modal antes de que el UITabBarController estuviera listo. Sin embargo, me sentí incómodo confiando en un retraso fijo antes de presentar el controlador de vista (de mi prueba, necesitaba usar un retraso de 0.05-0.1 s en performSelector:withDelay:). Mi solución es agregar un bloque que se llama en UITabBarController ' s viewDidAppear: método:

PRTabBarController.h:

@interface PRTabBarController : UITabBarController

@property (nonatomic, copy) void (^viewDidAppearBlock)(BOOL animated);

@end

PRTabBarController.m:

#import "PRTabBarController.h"

@implementation PRTabBarController

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    if (self.viewDidAppearBlock) {
        self.viewDidAppearBlock(animated);
    }
}

@end

Ahora en application:didFinishLaunchingWithOptions:

PRTabBarController *tabBarController = [[PRTabBarController alloc] init];

// UIWindow initialization, etc.

__weak typeof(tabBarController) weakTabBarController = tabBarController;
tabBarController.viewDidAppearBlock = ^(BOOL animated) {
    MyViewController *viewController = [MyViewController new];
    viewController.modalPresentationStyle = UIModalPresentationOverFullScreen;
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
    [weakTabBarController.tabBarController presentViewController:navigationController animated:NO completion:nil];
    weakTabBarController.viewDidAppearBlock = nil;
};
 0
Author: johnboiles,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-31 18:43:20

Encontré que, si está utilizando un guion gráfico, querrá poner el código que presenta el nuevo controlador de vista en viewDidAppear. También se deshará de la advertencia "Se desaconseja presentar controladores de vista en controladores de vista separados".

 0
Author: Dan Levy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-07 00:40:42

Debe asegurarse de que -(void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated y -(void)endAppearanceTransition se creen juntos en la clase.

 0
Author: zszen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-17 14:22:28

Tuve este problema cuando había navegado de raíz TVC a TVC A continuación, a TVC B. Después de tocar el botón "cargar" en TVC B Quería saltar directamente a la raíz TVC (no hay necesidad de volver a visitar TVC A así que por qué hacerlo). Tenía:

//Pop child from the nav controller
[self.navigationController popViewControllerAnimated:YES];
//Pop self to return to root
[self.navigationController popViewControllerAnimated:YES];

...lo que dio el error "Llamadas desequilibradas para comenzar / finalizar, etc.". Lo siguiente solucionó el error, pero sin animación:

//Pop child from the nav controller
[self.navigationController popViewControllerAnimated:NO];
//Then pop self to return to root
[self.navigationController popViewControllerAnimated:NO];

Esta fue mi solución final, sin error y aún animada:

//Pop child from the nav controller
[self.navigationController popViewControllerAnimated:NO];
//Then pop self to return to root, only works if first pop above is *not* animated
[self.navigationController popViewControllerAnimated:YES];
 -1
Author: dawid,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-06 10:03:53

Encontré este error cuando enganché un UIButton a una acción de segue de storyboard (en IB), pero más tarde decidí que el botón llamara programáticamente performSegueWithIdentifier olvidando eliminar el primero de IB.

En esencia, realizó la llamada segue dos veces, dio este error y en realidad empujó mi vista dos veces. La solución era eliminar una de las llamadas de segue.

¡Espero que esto ayude a alguien tan cansado como yo!

 -1
Author: capikaw,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-28 22:53:16