开发者

“EXC_BAD_ACCESS” in Xcode

while run iphone simulation, I show the error for "EXC_BAD_ACCESS" in Xcode

code is below :

Test.h

 @interface Test : UIViewController
 {
   int iWeight;
 }

end

Test.m

@implementation Test

- (void)viewDidLoad 
{
   iWeight = 15; 
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

    **NSLog(@"integer Number is :%@", iWeight);  // error occur**

}

If i click the Button of UIAlertView, Xcode occur "EXC_BAD_ACCESS" error at that code

I don't know why tha开发者_开发百科t code occur error. help me.


Try NSLog(@"integer Number is :%d", iWeight);


yes, try this

NSLog(@"wieght is %d",iweight);

%d type specifier for int iweight;

and also set property in .h file and synthesize it in .m file.

if it dont work then try this
remove your alertview method

write this


// .h file
-(IBAction)buttonClicked; 

// .m file
-(IBAction)buttonClicked
{
   NSLog(@"weight %d",iweight");
}

right click of button and assign TouchUpInside to buttonClicked method.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜