【发布时间】:2011-10-11 15:43:53
【问题描述】:
在运行 iphone 模拟时,我在 Xcode 中显示“EXC_BAD_ACCESS”的错误
代码如下:
测试.h
@interface Test : UIViewController
{
int iWeight;
}
end
测试.m
@implementation Test
- (void)viewDidLoad
{
iWeight = 15;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
**NSLog(@"integer Number is :%@", iWeight); // error occur**
}
如果我单击 UIAlertView 的按钮,Xcode 会在该代码处发生“EXC_BAD_ACCESS”错误
我不知道为什么该代码会出现错误。帮帮我。
【问题讨论】:
-
EXC_BAD_ACCESS 表示您在某处传递了错误的指针。你需要弄清楚是哪一行代码导致了它,然后弄清楚你在做什么来传递一个错误的指针。在格式方法中传递一个需要指针的整数是一种情况,但还有很多其他情况。
标签: iphone objective-c xcode cocoa-touch