A: 

I've just had the same problem. I was converting an existing iPhone app to run universal. I have several buttons that called UIAlertViews that work fine but I have a button that calls an actionsheet. It was generating the same error. In IB in my ipadview.xib in my view controller i had mislinked "view" to window when i should have linked it to the button. It now works fine. Hope this helps. (ps im a complete novice so forgive if this doesnt help) Neil

Neil
+2  A: 

Within the viewDidLoad method the view is not setup entirely. The window property is not wired up.

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

will probably show that window is null/nil.

Depending on your design, you may have luck with simply queueing it on the main thread:

-(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];
}
Eiko
Any ideas why this error would only occur on OS 3.2?
Tom Irving
No. Just speaking from my experience.
Eiko
A: 

I was having this problem and your solution works like a charm. Thanks Eiko.

Patricia
A: 

I was just working through the same chapter and the book's author addresses it here http://p2p.wrox.com/book-beginning-ipad-application-development/79379-ch-3-usingviews-alert-actionsheet.html though if I were you I would vote Eiko's response as the answer since it accomplishes the behavior the example is going for, whereas the authors has you create a button that you clicked after the application launches to see the sheet.

Felix