2011-08-09 37 views
1

我是Cocoa Touch的新手,我只是想搞清楚语言和框架。所以我只是想创建一个简单的应用程序,需要文本从UITextField,只是表明它在UIAlertView这里是操作方法:UIAlertView标题集发送“SIGABRT”

- (IBAction)showNotifAction:(id)sender { 
    putVal = _TextToDisplay.text; 
    _alertOne.title = @"Message"; 
    _alertOne.message = putVal; 
    [_alertOne show]; 
} 

出于某种原因,它打破了上一个SIGART线3。有什么我做错了吗?哦,顺便说一句,这是我AppDelegate实现:

@interface LearnAppDelegate : NSObject <UIApplicationDelegate> { 
    UITextField *_TextToDisplay; 
    UIButton *_ShowNotif;  
    UIAlertView *_alertOne; 
    NSString *putVal; 
} 

回答

1

您需要定义你的UIAlertView中。您尝试使用的指针指向什么都不指向或垃圾内存。

尝试像下面的代码:

UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:"My title" 
message:putVal 
delegate:nil 
cancelButtonTitle:@"OK" 
otherButtonTitles:nil] autorelease]; 
    [alert show];