Xcode错误消息:“ UIAlertAction没有可见的@interface声明了选择器...。”

时间:2018-10-01 20:12:38

标签: objective-c xcode viewcontroller uialertcontroller uialertaction

因此,我正在尝试在Xcode 10上为我的iPhone(iOS 12)制作一个具有密码锁定的应用程序。我在ViewController.m文件中,并试图运行代码:

    NSString *passwordString = [NSString stringWithFormat:@"1234"]; //CHANGE PASSWORD HERE
    if ([passwordField.text isEqualToString:passwordString]) {
        UIAlertAction *alert = [[UIAlertAction alloc] initWithTitles:@"Success" message:@"Success" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

但是每次似乎无论我尝试什么(正如其他帖子所建议的那样),我都会弹出相同的红色错误消息:

  

“ UIAlertAction”没有可见的@interface声明选择器'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTlttes:'

我曾尝试关闭ARC,但似乎没有给我选择的机会?我也尝试过将文件导入AppDelegate。

问题可能是我看过的某些教程在旧版本的Xcode中已经过时了。

0 个答案:

没有答案