我已加密文档。将每个文档解压后,我需要提示用户从登录表中输入文档密码。我有办法验证对文件内容的密码输入(这部分完成)。如果密码不正确,文件应关闭。如果密码正确,文档窗口应显示文档内容。提示用户登录加密文档
当我试图加载在文档的windowControllerDidLoadNib
方法登录片(通过其控制器)我无法识别选择错误,如下所示:
- (void)windowControllerDidLoadNib:(NSWindowController *)aController
{
[super windowControllerDidLoadNib:aController];
if (!newPasswordController){
newPasswordController = [[NewPasswordController alloc] init];
newPasswordSheet = [newPasswordController window];
}
[NSApp beginSheet:newPasswordSheet modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(didNewPasswordEnd:returnCode:contextInfo:)
contextInfo:nil];
}
[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance
方法[NewPasswordController init]
是这样实现的:
-(id)init
{
self = [super initWithWindowNibName:@"NewPassword"];
if (self) {
}
return self;
}
其中登录表单笔尖文件被称为NewPassword
。
我不知道出了什么问题。解决这个问题的最好方法是什么?
当使用“beginSheet”(在Xcode7中)时,我得到了“无法识别的选择器”,但它在我用代码调用“runModalForWindow”时起作用。 – 2015-07-18 14:23:10