Cocoa touch UIAlertView标题集发送“;SIGABRT“;
我是Cocoa Touch的新手,我只是在尝试对语言和框架有所了解。因此,我正在尝试创建一个简单的应用程序,它从Cocoa touch UIAlertView标题集发送“;SIGABRT“;,cocoa-touch,ios4,uialertview,Cocoa Touch,Ios4,Uialertview,我是Cocoa Touch的新手,我只是在尝试对语言和框架有所了解。因此,我正在尝试创建一个简单的应用程序,它从UITextField中获取文本,并在UIAlertView中显示它。下面是操作方法: - (IBAction)showNotifAction:(id)sender { putVal = _TextToDisplay.text; _alertOne.title = @"Message"; _alertOne.message = putVal; [_ale
UITextField
中获取文本,并在UIAlertView
中显示它。下面是操作方法:
- (IBAction)showNotifAction:(id)sender {
putVal = _TextToDisplay.text;
_alertOne.title = @"Message";
_alertOne.message = putVal;
[_alertOne show];
}
由于某种原因,它在第3行用一个SIGART中断。我做错什么了吗?哦,顺便说一句,这是我的AppDelegate
实现:
@interface LearnAppDelegate : NSObject <UIApplicationDelegate> {
UITextField *_TextToDisplay;
UIButton *_ShowNotif;
UIAlertView *_alertOne;
NSString *putVal;
}
@接口LearnAppDelegate:NSObject{
UITextField*\u text显示;
UIButton*\u ShowNotif;
UIAlertView*_alertOne;
NSString*putVal;
}
您需要定义UIAlertVIew。您试图使用的指针指向的是空的或垃圾内存
请尝试以下代码:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:"My title"
message:putVal
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alert show];
您需要定义UIAlertVIew。您试图使用的指针指向的是空的或垃圾内存 请尝试以下代码:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:"My title"
message:putVal
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alert show];