因此,我试图在我的iPhone应用程序中运行此代码,但该应用程序始终崩溃。有什么办法吗?
- (IBAction)logOutBtnDown:(id)sender {
[PFUser logOut];
NSArray *quotes;
int r;
quotes = [NSArray arrayWithObjects:
@"R u done yet",
@"Log in again",
@"Try Me",
@"SMD",
@"We can do this all day",
@"IDC your eating up ur RAM",
"Please just connect to the servers",
@"You are not giving up are u",
@"Forget it I quit",
@"Imma tell TDK",
nil];
r = arc4random() % 10;
[_welcomeLabel setText:[NSString stringWithFormat:@" %@", [quotes objectAtIndex: r]]];
}
最佳答案
添加对象时错过了@,
试试这个
- (IBAction)logOutBtnDown:(id)sender {
[PFUser logOut];
NSArray *quotes;
int r;
quotes = [NSArray arrayWithObjects: @"R u done yet", @"Log in again", @"Try Me", @"SMD", @"We can do this all day", @"IDC your eating up ur RAM", @"Please just connect to the servers", @"You are not giving up are u", @"Forget it I quit", @"Imma tell TDK", nil];
r = arc4random() % 10;
[_welcomeLabel setText:[NSString stringWithFormat:@" %@", [quotes objectAtIndex: r]]];
}
关于iphone - 每当我尝试运行此代码时,iPhone都会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14411050/