简体   繁体   English

NSInternalInconsistencyException错误

[英]NSInternalInconsistencyException error

I am having issues switching between view controllers. 我在视图控制器之间切换时遇到问题。

My md360AppDelegate.h header looks like this 我的md360AppDelegate.h标头看起来像这样

#import <UIKit/UIKit.h>
@class md360ViewController;
@interface md360AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) md360ViewController *viewController;
@property (strong, nonatomic) UINavigationController *navigationController;
@end

and my md360AppDelegate.m implementation looks like this. 我的md360AppDelegate.m实现看起来像这样。

#import "md360AppDelegate.h"
#import "md360ViewController.h"

@implementation md360AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[md360ViewController alloc] initWithNibName:@"md360ViewController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    [self.window setRootViewController:self.navigationController];
    [self.window makeKeyAndVisible];
    return YES;
}
@end

i am creating an instance of UINavigationController and storing it in navigationController property of this class. 我正在创建一个UINavigationController实例并将其存储在此类的navigationController属性中。

I want to change the ViewController when a user click on a button in md360ViewController. 我想在用户单击md360ViewController中的按钮时更改ViewController。

My md360ViewController.h looks like this. 我的md360ViewController.h看起来像这样。

@interface md360ViewController : UIViewController
@property IBOutlet UIButton *homePathwayBtn;
@property IBOutlet UIButton *homeDiseaseBtn;
@property IBOutlet UIButton *homePipelineBtn;
- (IBAction)homeButton:(id)sender;
@end

and my implementation looks something like 我的实现看起来像

#import "md360ViewController.h"
#import "md360AppDelegate.h"
#import "pipeViewDisease.h"
#import <QuartzCore/QuartzCore.h>

    - (IBAction)homeButton:(id)sender {
        UIViewController *pipeViewDisease = [[UIViewController alloc] initWithNibName:@"pipeViewDiease" bundle:nil];
        [self.navigationController pushViewController:pipeViewDisease animated:YES];
    }

and when i click on UIButton the application crash with following message. 当我点击UIButton时,应用程序崩溃并显示以下消息。

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'pipeViewDiease'' 由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无法在bundle中加载NIB:'NSBundle(loaded)',名称为'pipeViewDiease''

what could be the issue? 可能是什么问题?

Probably just a misspelled NIB name: 可能只是一个拼写错误的NIB名称:

initWithNibName:@"pipeViewDiease"

should be: 应该:

initWithNibName:@"pipeViewDisease"
                            ^

Unless it's a spelling mistake (should be pipeViewDisease), this error usually occurs when files are re-named outside of the xCode environment. 除非是拼写错误(应该是pipeViewDisease),否则在xCode环境之外重命名文件时通常会发生此错误。

To fix this: 解决这个问题:

  • remove the file in question from the project 从项目中删除有问题的文件
  • re-import the files to your project. 将文件重新导入项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的代码中的NSInternalInconsistencyExceptionException错误 - NSInternalInconsistencyException error in my code Swift 5.1 NSInternalInconsistencyException 错误 - Swift 5.1 NSInternalInconsistencyException error SwiftUI 拖放错误“NSInternalInconsistencyException” - SwiftUI Drag and Drop error “NSInternalInconsistencyException” XCode错误:未捕获的异常&#39;NSInternalInconsistencyException&#39; - XCode Error: uncaught exception 'NSInternalInconsistencyException' NSInternalInconsistencyExceptionException错误删除表视图单元格 - NSInternalInconsistencyException error removing tableview cell Swift UITableViewController搜索错误-[NSInternalInconsistencyException] - Swift UITableViewController Search Error - [NSInternalInconsistencyException] 在iOS 5.0.1中获取NSInternalInconsistencyExceptionException错误 - Getting an NSInternalInconsistencyException Error in iOS 5.0.1 swift 中的 collectionView 出现 NSInternalInconsistencyException 错误 - NSInternalInconsistencyException error from collectionView in swift 由于未捕获的异常&#39;NSInternalInconsistencyException&#39;错误而终止应用程序 - Terminating app due to uncaught exception 'NSInternalInconsistencyException' error 使用代理插入行时出现NSInternalInconsistencyExceptionException错误 - NSInternalInconsistencyException error when inserting row using Delegate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM