Ios 将无法识别的选择器发送到新添加方法的实例;以前定义的方法的消息可以正常工作
“-[MTviewFilesVC launchVF]:发送到实例0x1e59fcd0的选择器无法识别” 我向类添加了一个方法,但调用它会产生“无法识别的选择器”运行时错误 呼叫代码为:Ios 将无法识别的选择器发送到新添加方法的实例;以前定义的方法的消息可以正常工作,ios,Ios,“-[MTviewFilesVC launchVF]:发送到实例0x1e59fcd0的选择器无法识别” 我向类添加了一个方法,但调用它会产生“无法识别的选择器”运行时错误 呼叫代码为: self.viewFilesVCPtr = [[MTviewFilesVC alloc] init]; [self.viewFilesVCPtr launchVF]; 例如,如果我替换了已经存在的viewDidLoad,那么这是可行的 我认为调用代码是可以的。在lanuchVF的声明中还有什么需要添加的吗 让它
self.viewFilesVCPtr = [[MTviewFilesVC alloc] init];
[self.viewFilesVCPtr launchVF];
例如,如果我替换了已经存在的viewDidLoad,那么这是可行的
我认为调用代码是可以的。在lanuchVF的声明中还有什么需要添加的吗
让它可见
方法声明等为:
.h:
.m中的方法名称有一个输入错误,
lanuchVF
而不是launchVF
:-)您在.m中的方法名称有一个输入错误,lanuchVF
而不是launchVF
:-)这应该是一个编译器警告,提示您的实现不完整。这是保持您的项目无警告的一个很好的理由。这应该是编译器警告您的实现不完整。这是一个很好的理由,让您的项目警告免费。grrrrrr!谢谢,我的坏朋友!grrrr!谢谢,我的坏朋友!
#import "DirectoryWatcher.h"
@interface MTviewFilesVC : UITableViewController <QLPreviewControllerDataSource,
QLPreviewControllerDelegate,
DirectoryWatcherDelegate,
UIDocumentInteractionControllerDelegate>
-(IBAction)saveViewFiles;
- (void)launchVF;
@end
@interface MTviewFilesVC ()
@property (nonatomic, strong) DirectoryWatcher *docWatcher;
@property (nonatomic, strong) NSMutableArray *documentURLs;
@property (nonatomic, strong) UIDocumentInteractionController *viewFileController;
-(void) launchVF;
@end
...
- (void)lanuchVF
{
UIStoryboard *settingsStoryBoard = [UIStoryboard storyboardWithName:
@"viewFiles" bundle:nil];
UIViewController *initialViewFilesVC = [settingsStoryBoard instantiateInitialViewController];
initialViewFilesVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:initialViewFilesVC animated:YES];
}