【发布时间】:2012-03-02 16:35:56
【问题描述】:
有人知道这意味着什么以及如何解决吗?
* -[UIActionSheet showInView:] 中的断言失败,/SourceCache/UIKit_Sim/UIKit-1912.3/UIActionSheet.m:4630 2012-03-02 17:12:34.643 Strategy & Risk[66854:15803] * 终止应用程序由于 未捕获的异常“NSInternalInconsistencyException”,原因: '无效参数不满足:view != nil'
更新:它只是偶尔发生:
更新 2:我的应用中没有标签栏或工具栏
更新 3:我已更改代码以使用 showInView: 并且收到完全相同的错误消息。
- (void)displayAddEntityActionSheet {
//Convert the tap location to this view's coordinate systems
CGRect buttonTappedRect = [self.currentNodeView convertRect:self.currentNodeView.frame toView:self.view];
UIActionSheet *actionSheet;
switch (self.currentNode.nodeType) {
case NodeTypeEntity:
actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil otherButtonTitles:@"Entity", @"Objective", nil] autorelease];
[actionSheet showFromRect:buttonTappedRect inView:self.view animated:YES];
break;
case NodeTypeObjective:
actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil otherButtonTitles:@"Risk", @"KPI", nil] autorelease];
[actionSheet showFromRect:buttonTappedRect inView:self.view animated:YES];
break;
case NodeTypeRisk:
actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil otherButtonTitles:@"KRI", @"Control", nil] autorelease];
[actionSheet showFromRect:buttonTappedRect inView:self.view animated:YES];
break;
case NodeTypeControl:
actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil otherButtonTitles:@"KCI", nil] autorelease];
[actionSheet showFromRect:buttonTappedRect inView:self.view animated:YES];
break;
default:
break;
}
}
【问题讨论】:
-
你能告诉我们你创建actionSheet的代码吗?
-
除非您发布一些代码,否则我们无话可说。
-
@TheLearner 请参考我的回答,我认为这个回答会帮助你解决这个断言失败。
标签: iphone objective-c cocoa-touch