gpt4 book ai didi

iphone - 在UIAlertView上出现一些错误

转载 作者:行者123 更新时间:2023-12-01 17:45:28 25 4
gpt4 key购买 nike

我不知道为什么会这样。在我看来,这是正确的。我写了另一个UIAlertView,看起来还不错,一删除它,它就会错误处理我写的那个。我正在尝试遵循tutorial

这是在我的viewcontroller.m中

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{


switch (result) {
case MessageComposeResultCancelled:
NSLog(@"Cancelled");
break;
case MessageComposeResultFailed:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome To My App" message:@"This app will ... First you need to ..." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];

break;
case MessageComposeResultSent:

break;
default:
break;
}

[self dismissModalViewControllerAnimated:YES];
}

错误显示在错误的许多行上,例如:消息发送表达式开头缺少“[”。 (如果我把它放进去,它要在initWithTitle之后再放一个:)

下一个错误是:使用未声明的标识符“警报”(在演出和发行中这样说)

知道发生了什么吗?提前致谢。

最佳答案

尝试在包含多行的case语句中添加方括号。

- (void)messageComposeViewController:(MFMessageComposeViewController
*)controller didFinishWithResult:(MessageComposeResult)result {


switch (result) {
case MessageComposeResultCancelled:
NSLog(@"Cancelled");
break;
case MessageComposeResultFailed: {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome To My App" message:@"This app will ... First you need to ..." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];

break;
}
case MessageComposeResultSent:

break;
default:
break; }

[self dismissModalViewControllerAnimated:YES]; }

关于iphone - 在UIAlertView上出现一些错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7677057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com