每次我尝试运行此代码时,iPhone都会崩溃

每次我尝试运行此代码时,iPhone都会崩溃,iphone,ios,objective-c,nsarray,ibaction,Iphone,Ios,Objective C,Nsarray,Ibaction,因此,我试图在我的iPhone应用程序中运行此代码,但应用程序不断崩溃。有什么解决办法吗 - (IBAction)logOutBtnDown:(id)sender { [PFUser logOut]; NSArray *quotes; int r; quotes = [NSArray arrayWithObjects: @"R u done yet", @"Log in again", @"Try Me",

因此,我试图在我的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]]];

}

添加对象时未放置@

试试这个

- (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]]];

}

告诉我崩溃发生的确切位置?使用
arc4random\u uniform
instand of
arc4random()
你能告诉控制台显示的确切崩溃错误是什么吗?告诉我崩溃发生的确切位置吗?使用
arc4random\u uniform
instand of
arc4random()
你能告诉控制台显示的确切崩溃错误是什么吗?