好吧,所以這裏有很多答案,但它們都沒有爲我工作。基本上我寫了一個非常簡單的iOS應用程序,它有一個標籤和一個按鈕。點擊按鈕並且標籤改變。下面是代碼SIGABRT線程錯誤運行簡單的ios應用程序
//ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
- (IBAction)buttonPressed:(id)sender;
@property (strong, nonatomic) IBOutlet UILabel *predictionLabel;
@end
//
// ViewController.m
// CrystalBall
//
//
//
#import "ViewController.h"
@implementation ViewController
@synthesize predictionLabel;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setPredictionLabel:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)buttonPressed:(id)sender {
self.predictionLabel.text = @"Definitley Yes!";
}
@end
當我在模擬器中運行的應用程序打開罰款,然後我點擊「預測」按鈕,然後將其凍結,這是在綠色
Thread 1: Program recieved signal: "SIGABRT".
顯示了錯誤
即沿着一條線,其讀取 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
調試器表示: 2013年1月19日22:53:30.511 CrystalBall [441:F803] *終止應用程序由於未捕獲的異常' NSInvalidArgumentException」的,理由是: ' - [UIView的的setText:]:無法識別的選擇發送到實例0x6a19c70' *第一擲調用堆棧: 2013-01-19 22:53:30.511 CrystalBall[441:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setText:]: unrecognized selector sent to instance 0x6a19c70' *** First throw call stack: (0x13b9052 0x154ad0a 0x13baced 0x131ff00 0x131fce2 0x2385 0x13baec9 0x135c2 0x1355a 0xb8b76 0xb903f 0xb82fe 0x38a30 0x38c56 0x1f384 0x12aa9 0x12a3fa9 0x138d1c5 0x12f2022 0x12f090a 0x12efdb4 0x12efccb 0x12a2879 0x12a293e 0x10a9b 0x1da8 0x1d05) terminate called throwing an exception(gdb)
希望這是足夠的信息。謝謝!
看起來像我沒有預測標籤正確定義。謝謝 – user1074202
歡迎您! – sergio