1

In testing my application to see how it will work with an XCode 5 build on iOS 8. The biggest problem I have is that all of our confirmation dialogs cause the application to crash. If I build it on XCode 6 beta, it doesn't crash but the popup is not centered in the window.

Here is the code. It calls the showInView, but does not return. So my question is, am I doing something wrong? If not, what changed, and how do I fix it?

The NSException is being thrown on the showInView

-- reason NSString * @"Application tried to present modally an active controller <_UIAlertShimPresentingViewController: 0x7fab69793330>." 0x00007fab69747ec0

UIActionSheet* confirmAction = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"SiteUpToDate", nil)
                                                           delegate:self 
                                                  cancelButtonTitle:nil 
                                             destructiveButtonTitle:NSLocalizedString(@"Yes", nil)
                                                  otherButtonTitles:NSLocalizedString(@"No", nil), nil];

[confirmAction showInView:self.view];
[confirmAction release];

Update: I found that this was an issue with the Beta OS & Beta XCode. As soon as iOS 8 was officially released, our issues went away.

Brian S
  • 3,096
  • 37
  • 55
  • 1
    Is this for iPhone, iPad or both? Does it work on one but not the other? – Popeye Jul 21 '14 at 17:51
  • I had only tried this on a physical iPad Air. I have not tried on a Air simulator, same problem, and an iPhone 5s, which does not have the problem. So it seems related to the tablet. – Brian S Jul 21 '14 at 18:22
  • I meant to say I have NOW tried on an Air simulator. – Brian S Jul 21 '14 at 18:28
  • The exception is being thrown on the showInView, it's not getting to the release. I updated the question to show the exception being thrown. – Brian S Jul 21 '14 at 19:43
  • for better compatibility with ios 8 you should use conditional code for the ios 8 and use UIAlertController. – Banker Mittal Nov 19 '14 at 05:01

3 Answers3

0

I also had the same problem. i used ShowFromBarButtonItem function instead of ShowInView Function.

[organizeActionSheet showFromBarButtonItem:btnAction animated:NO]; if use ShowFromRect or showFromBarButtonItem runtime exception will not come. i think it is a bug of IOS8 Beta, when i use ShowInView Runtime exception is coming.

This bug is not happening in IOS Beta 4..

I do get some warning messages in the debug window when built using Xcode 5.1, but the action sheet does appear. In iOS 8 beta 4, it appears as a small pop-up window outside of the view (at the side), whereas in iOS 7, it used to appear as buttons that slid up from the bottom of the view.

Sabareesh
  • 3,585
  • 2
  • 24
  • 42
0

according to this https://developer.apple.com/library/ios/documentation/Uikit/reference/UIActionSheet_Class/index.html UIActionSheet is deprecated, you should use UIAlertController instead of UIActionSheet. Answer is from here: How to do "actionSheet showFromRect" in iOS 8?

Community
  • 1
  • 1
user306481
  • 135
  • 1
  • 11
0

Something that might fix your problem. We were running into a lot of issues when presenting UIActionSheets directly after dismiss any kind of modal view controller. If this is indeed the case, you need to call the action sheet 'presentInView...' methods only AFTER the first modal has gone away.

Ying
  • 1,944
  • 5
  • 24
  • 38