我正在 xcode 中编写一个简单的应用程序,但是每当我尝试在模拟器中运行该应用程序时,我都会得到以下信息:
Thread 1: Signal SIGABRT
libc++abi.dylib: terminate called throwing an exception
(lldb)
它在第 25 行的 applicationDidFinishLaunchingWithOptions 处崩溃:[self.window makeKeyAndVisible];
我的代码:
- (IBAction)handleTap:(UITapGestureRecognizer *)recognizer {
NSArray * entre = @[ @"Indian", @"American", @"Chinise", @"Italien", @"Japenese", @"Barbeque", @"Breakfast", @"Pizza" ];
NSArray * dessert = @[ @"Ice Cream", @"Cake", @"Pie", @"Gelato", @"Cupcakes"];
NSInteger r = arc4random()%8;
NSInteger f = arc4random()%4;
switch (segmentedControl.selectedSegmentIndex) {
case 0:
[label setText:[NSString stringWithFormat: entre[r]]];
break;
case 1:
[label setText: [NSString stringWithFormat: dessert[f]]];
default:
break;
}
}