因此,我正在尝试在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中已经过时了。