Could not load NIB in bundle - inspiration needed

拜拜、爱过 提交于 2020-01-01 07:26:08

问题


I'm currently seeing this error:

MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Could not load NIB in bundle: 'NSBundle </Users/imac/Library/Application Support/iPhone Simulator/5.0/Applications/5D8B4B51-9FB2-4331-BFEB-B1A0AC77DF42/Tutorial.app> (loaded)' with name 'MyFirstView'

I've looked through lots of other questions like:

  • NSInternalInconsistencyException Could not load nib in bundle
  • Could not load NIB in bundle
  • and lots of others

But I can't see that any apply here - they are mainly about file naming issues and my Nib does appear to be in the output package file with the correct name.

I'm using MonoTouch 5.2.5 and xcode 4.2, and targeting SDK5

Does anyone have any ideas about what I could try to fix this?


回答1:


I have faced the same Problem today. I refactored (rename) viewController to myCustomViewController and got this error. When I searched in my project files, I saw that I have used self.viewController = [[[MyTableViewController alloc] initWithNibName:@"viewController" bundle:nil] autorelease];

NibName was changed but in @" " it was old name. so I changed it to

self.viewController = [[[MyTableViewController alloc] initWithNibName:@"MyTableViewController" bundle:nil] autorelease];

and error was removed. Do it and hope your error will be removed. Vote up if it helps.




回答2:


The problem eventually it seems was somewhere in the extended toolchain - somewhere between MonoDevelop, xCode4 and the simulator.

Restarting everything, and resetting the simulator cleared the problem.

Later in the same chain I've seen smaller issues with "old NIB file outlets" persisting on the simulator even after I've definitely deleted them and rebuilt - so something is still going wrong somewhere... but a clean solves it each time.




回答3:


So I had a similar solution in MonoDevelop. I created an empty mono touch project. When I deleted the xib file associated with the auto created project, i ran into problems. Even though I created a new view and connected the outlet to that controller, I had to go back and recreate the xib file associated with the controller (with the same name) again, and then connect that original view and controller via the outlet



来源:https://stackoverflow.com/questions/9414036/could-not-load-nib-in-bundle-inspiration-needed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!