Trying to debug "Verification failed in - Error [UIActionSheet showInView:]"

I’m working on “Getting started developing applications for the iPad,” and I hung up in Chapter 3, where I created a project that works with an action sheet.

As of now, my application loads into the simulator just fine, without errors that I know of, but as it launches it crashes with the following errors appearing in the debugger window:

2010-05-31 19: 44: 39.703 UsingViewsActionSheet [49538: 207] *** Approval denial - - [UIActionSheet showInView:], / SourceCache / UIKit _Sim / UIKit-1145.66 / UIAlert.m: 7073

2010-05-31 19: 44: 39.705 UsingViewsActionSheet [49538: 207] *** The application terminated due to the uncaught exception "NSInternalInconsistencyException", reason: "Invalid parameter not satisfying: view! = Nil

I am sure this is the block where the application breaks based on my use of breakpoints.

// viewDidLoadDeploy to perform additional configuration after loading the view, usually from nib.

- (void)viewDidLoad { UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"This is my Action Sheet!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:@"Delete Message!" otherButtonTitles:@"Option 1", @"Option 2", @"Option 3", nil];

[action showInView:self.view];  // <-- This line seems to trigger the crash....
[action release];
[super viewDidLoad];

} Code>

Am I missing something obvious, or is there a problem with something shown here? I looked through the abstract for showInView and I can not divine anything there.

I appreciate everything and everyone contesting.

Hi,

Steve O'Sullivan

+3
source share
5 answers

viewDidLoad . window .

NSLog(@"View: %@; Window: %@",[self.view description], [self.view.window description]);

, , null/nil.

, :

-(void) showMyActionSheet
{
    UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"This is my Action Sheet!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:@"Delete Message!" otherButtonTitles:@"Option 1", @"Option 2", @"Option 3", nil]; 
    [action showInView:self.view];
    [action release];
}

- (void)viewDidLoad 
{
    [super viewDidLoad]; 
    [self performSelectorOnMainThread:@selector(showMyActionSheet) withObject:nil waitUntilDone:NO];
}
+11

. iPhone, . , UIAlertViews, , , . . IB ipadview.xib "" , . . . (ps im , , )

+1

5.0 (9A334) iPad- (iPads).

Eiko .

0

ActionSheet :

UIWindow* window = [[[UIApplication sharedApplication] delegate] window];
    if ([window.subviews containsObject:self.view]) {
        [action showInView:self.view];
    } else {
        [action showInView:window];
    }

.

0
source

Source: https://habr.com/ru/post/1747922/


All Articles