UIActionSheet在iPad /不是iPhone上崩溃 [英] UIActionSheet Crashes on iPad / not iPhone

查看:113
本文介绍了UIActionSheet在iPad /不是iPhone上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在控制台中查看时,收到此消息

When I look in the console I get this message


2010-09-18 17:04:05.284 Wasted Time[8998:207] *** Assertion failure in -[UIActionSheet showInView:], /SourceCache/UIKit_Sim/UIKit-1145.66/UIAlert.m:7073
2010-09-18 17:04:05.286 Wasted Time[8998:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil'
2010-09-18 17:04:05.286 Wasted Time[8998:207] Stack: (
    42272848,
    43430700,
    42010379,
    811796,
    3796273,
    3862560,
    9631,
    3616645,
    3688229,
    3682846,
    3690662,
    3686119,
    4983946,
    71264534,
    71263781,
    71207378,
    71206706,
    3003734,
    3030334,
    3011831,
    3043800,
    51265916,
    41552028,
    41547944,
    3002913,
    3036018,
    8314
)
terminate called after throwing an instance of 'NSException'

代码如下:

- (void)viewDidLoad {
    BOOL    continueYesNo;
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    continueYesNo = [prefs boolForKey:@"keyContinueMeeting"];   
    if (continueYesNo) {
        NSString *message_continue = [[NSString alloc] initWithFormat:@"Do you want to Continue the Prior Meeting"];
        UIActionSheet *actionSheet = [[UIActionSheet alloc] 
            initWithTitle:message_continue 
            delegate:self
            cancelButtonTitle:@"Reset" 
            destructiveButtonTitle:@"Continue"
            otherButtonTitles:nil];
        [actionSheet showInView:self.view];
        [actionSheet release];
        [message_continue release];
    }
}

它在iPhone和iPhone

It runs fine both in the iPhone and in the iPhone simulator, but crashes in the iPad simulator.

推荐答案

错误信息:


无效的参数不满足:view!= nil

Invalid parameter not satisfying: view != nil

p>

Likely from this line:

[actionSheet showInView:self.view];

由于你说这在iPhone上而不是iPad上,这意味着iPad的代码路径获得这条线可能不同于iPhone取得这条线路的代码路径。这意味着可能没有为iPad设置视图控制器的视图属性。

Since you say this works on iPhone but not iPad, that means that the code path the iPad takes to get to this line is probably different than the code path the iPhone takes to get to this line. Which means that the view controller's view property is probably not set for the iPad.

我的猜测:你忘了在Interface Builder中连接此视图控制器使用的xib的iPad版本的视图插件。

My guess: you forgot to hook up the view outlet in Interface Builder for the iPad version of the xib this view controller is using.

这篇关于UIActionSheet在iPad /不是iPhone上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆