Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing sentinel in UIAlertView allocation

UIAlertView *alert = [[UIAlertView alloc]
    initWithTitle:@"Error"
    message:@"Some failure message"
    delegate:self 
    cancelButtonTitle:@"cancel"
    otherButtonTitles:@"retry", nil
];  
[alert show];
[alert release];

I got two warnings pointing at this block of code.

  • Unused variable 'alert'
  • Missing sentinel in function call

My code looks similar to all the examples online. Why is it broken?

like image 339
JoJo Avatar asked Dec 18 '25 10:12

JoJo


1 Answers

This code works fine for me. Try cleaning all targets and building again to see if the error persists.

Because you call [alert show], you should not get an unused variable warning on alert.

Since you include nil after otherButtonTitles, you should not get a missing sentinel warning.

like image 110
PengOne Avatar answered Dec 20 '25 01:12

PengOne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!