ipad xcode5 uiactionsheet ios8

ipad - Accidente de UIActionSheet en iOS8beta



xcode5 (5)

Estoy teniendo el mismo problema, y ​​esto todavía está "roto" en la versión beta 5. En mi caso, solo estoy obteniendo una pantalla atenuada sin hoja de acción en lugar de una falla.

Excepto que mostrar una hoja de acción directamente en una vista en iPad no es un buen diseño de todos modos. Debes usar popover que contenga una hoja de acción y apuntar al botón o elemento de UI que generó la opción como sugirió Sabareesh. Las alertas son para mensajes que están desconectados de cualquier elemento de la interfaz de usuario, las hojas de acción siempre están asociadas con un elemento de interfaz de usuario en pantalla hasta donde yo sé.

Tengo un código que simplemente muestra UIActionSheet al hacer clic en el botón. pero se bloqueará cuando lo construya usando XCode5.1 + iOS8beta en iPad.

a continuación se muestra un código que utilicé para mostrar UIActionSheet.

UIActionSheet *tmpActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles: @"Ok", nil]; [tmpActionSheet showInView:self.view];

Nota:
- Funciona perfectamente con XCode6beta + iOS8beta (iPhone / iPad ambos)
- Funciona perfectamente con XCode5.1 + iOS8beta (solo iPhone)

El registro mientras se produce la excepción es el siguiente.

2014-06-23 15:54:04.860 ActionSheetDemo[680:191598] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don''t want. Try this: (1) look at each constraint and try to figure out which you don''t expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you''re seeing NSAutoresizingMaskLayoutConstraints that you don''t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSLayoutConstraint:0x14e60ef0 V:|-(0)-[UIView:0x14d419a0] (Names: ''|'':UIView:0x14d3a8b0 )>", "<NSLayoutConstraint:0x14e60880 _UIDimmingKnockoutBackdropView:0x14d2ca80.top == UIView:0x14d419a0.top>", "<NSLayoutConstraint:0x14e61600 V:[_UIDimmingKnockoutBackdropView:0x14d2ca80(>=44)]>", "<NSLayoutConstraint:0x14e66240 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x14e66240 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 2014-06-23 15:54:04.872 ActionSheetDemo[680:191598] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don''t want. Try this: (1) look at each constraint and try to figure out which you don''t expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you''re seeing NSAutoresizingMaskLayoutConstraints that you don''t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSLayoutConstraint:0x14e60ef0 V:|-(0)-[UIView:0x14d419a0] (Names: ''|'':UIView:0x14d3a8b0 )>", "<NSLayoutConstraint:0x14e60880 _UIDimmingKnockoutBackdropView:0x14d2ca80.top == UIView:0x14d419a0.top>", "<NSLayoutConstraint:0x14e61600 V:[_UIDimmingKnockoutBackdropView:0x14d2ca80(>=44)]>", "<NSLayoutConstraint:0x14d25f80 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x14d25f80 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 2014-06-23 15:54:04.878 ActionSheetDemo[680:191598] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don''t want. Try this: (1) look at each constraint and try to figure out which you don''t expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you''re seeing NSAutoresizingMaskLayoutConstraints that you don''t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSLayoutConstraint:0x14e60ef0 V:|-(0)-[UIView:0x14d419a0] (Names: ''|'':UIView:0x14d3a8b0 )>", "<NSLayoutConstraint:0x14e60880 _UIDimmingKnockoutBackdropView:0x14d2ca80.top == UIView:0x14d419a0.top>", "<NSLayoutConstraint:0x14e61600 V:[_UIDimmingKnockoutBackdropView:0x14d2ca80(>=44)]>", "<NSLayoutConstraint:0x14e67740 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x14e67740 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 2014-06-23 15:54:04.885 ActionSheetDemo[680:191598] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don''t want. Try this: (1) look at each constraint and try to figure out which you don''t expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you''re seeing NSAutoresizingMaskLayoutConstraints that you don''t understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSLayoutConstraint:0x14e60ef0 V:|-(0)-[UIView:0x14d419a0] (Names: ''|'':UIView:0x14d3a8b0 )>", "<NSLayoutConstraint:0x14e60880 _UIDimmingKnockoutBackdropView:0x14d2ca80.top == UIView:0x14d419a0.top>", "<NSLayoutConstraint:0x14e61600 V:[_UIDimmingKnockoutBackdropView:0x14d2ca80(>=44)]>", "<NSLayoutConstraint:0x14d38a30 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x14d38a30 _UIDimmingKnockoutBackdropView:0x14d2ca80.bottom ==> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 2014-06-23 15:54:04.892 ActionSheetDemo[680:191598] *** Terminating app due to uncaught exception ''NSInvalidArgumentException'', reason: ''Application tried to present modally an active controller <_UIAlertShimPresentingViewController: 0x14d450c0>.'' *** First throw call stack: (0x24702c2f 0x315cdd1f 0x27ffa6e7 0x27df9799 0x2838f3bd 0x2838e94d 0x6bfdd 0x27d4a6c7 0x27d4a669 0x27d34a4d 0x27d4a099 0x27d49d73 0x27d42ff1 0x27d198b1 0x27f8f13d 0x27d183c1 0x246ca597 0x246c99ab 0x246c8029 0x246145a1 0x246143b3 0x2b8cc1b9 0x27d78c41 0x6c239 0x31b67aaf) libc++abi.dylib: terminating with uncaught exception of type NSException
Pregunta:
1] ¿Por qué mi aplicación falla?
2] ¿Es iOS8beta error? Parche hasta manzana soluciona este problema
Crear la categoría Objective-C categor para la clase UIActionSheet

CÓDIGO:

#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) @implementation UIActionSheet (simplyShowInViewAddition) - (void) simplyShowInView:(UIView *) view { if(SYSTEM_VERSION_LESS_THAN(@"8.0")) { [self showInView:view]; } else { // "Translating" UIActionSheet to UIAlertController for better compatibility with iOS 8 UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:self.title preferredStyle:UIAlertControllerStyleActionSheet]; int nactions = [self numberOfButtons]; int i=0; while(i<nactions) { NSString *button_title=[self buttonTitleAtIndex:i]; UIAlertActionStyle style=UIAlertActionStyleDefault; if(i==[self cancelButtonIndex]) { style = UIAlertActionStyleCancel; } else if(i==[self destructiveButtonIndex]) { style = UIAlertActionStyleDestructive; } UIAlertAction *newAction = [UIAlertAction actionWithTitle:button_title style:style handler:^(UIAlertAction *action) { NSLog(@"clicked action %d",i); [self.delegate actionSheet:self clickedButtonAtIndex:i]; }]; [alert addAction:newAction]; i++; } if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [alert setModalPresentationStyle:UIModalPresentationPopover]; UIPopoverPresentationController *popPresenter = [alert popoverPresentationController]; popPresenter.sourceView = view; popPresenter.sourceRect = CGRectMake(view.frame.size.width/2-1, 0.45*view.frame.size.height, 2, 1); popPresenter.permittedArrowDirections = 0; } UIViewController *sourceViewController; if(self.delegate!=nil && [self.delegate respondsToSelector:@selector(presentViewController:animated:completion:)]) { NSLog(@"presenting UIAlertController on source view controller"); sourceViewController=(UIViewController *)(self.delegate); } else { // When the actionsheet delegate is not a UIViewController NSLog(@"presenting UIAlertController on displayed view controller"); sourceViewController = /* Set up a method here to obtain the view controller where you want to display it */ } [sourceViewController presentViewController:alert animated:YES completion:nil]; } }

Enlace de referencia


También tuve el mismo problema. utilicé la función ShowFromBarButtonItem en lugar de la función ShowInView.

[organizeActionSheet showFromBarButtonItem:btnAction animated:NO];

si no se aplica la excepción de tiempo de ejecución ShowFromRect o showFromBarButtonItem . Creo que es un error de IOS8 Beta, cuando uso la excepción ShowInView Runtime se acerca.

Este error no está sucediendo en IOS Beta 4 ..

Obtengo algunos mensajes de advertencia en la ventana de depuración cuando se construye usando Xcode 5.1, pero la hoja de acción aparece. En iOS 8 beta 4, aparece como una pequeña ventana emergente fuera de la vista (en el lateral), mientras que en iOS 7, solía aparecer como botones que se deslizaban desde la parte inferior de la vista.


He visto el mismo problema por un tiempo con showInView que no funciona desde IOS 8 Beta 2 hasta Beta 5. Acabo de enviar el informe de errores: 17971746.


También sufro un colapso en iOS8 final en iPad.

Esta es mi solución simple:
reemplazar
[actionSheet showFromBarButtonItem:myButton animated:YES];
por
[actionSheet showFromRect:myButton.navBarView.frame inView:self.view animated:YES];