NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle
This error can occur when you rename files outside of XCode.
To solve it you can just remove the files from your project (Right Click - Delete and "Remove Reference").
Then after you can re-import the files in your project and everything will be OK.
NSInternalInconsistencyException Could not load nib in bundle
It looks like you're trying to instantiate a nib called ThemePickerController.nib and it isn't present. Is the nib included as a project member?
Custom cell is causing a 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
If xib name is ParentTableViewCell.xib
Then you should do
itemsTable.register(UINib(nibName: "ParentTableViewCell", bundle: nil), forCellReuseIdentifier: "parentCell")
Exception : 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle..... in Swift 4
While registert nib, nibName shoudbe Cell namee means CustomCellOneCollectionViewCell
collectionViewOne.register(UINib(nibName: "CustomCellOneCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell1")
collectionViewOne.delegate = self
collectionViewOne.datasource = self
and in cellForItemAt
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell1", for: indexPath) as! CustomCellOneCollectionViewCell
return cell
}
NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
see the difference of the following 3 ways to instantiate something from your Interface Builder work.
[NSStoryboard.mainStoryboard instantiateControllerWithIdentifier:@"youridentifier"];
NSStoryboard *launchScreen = [NSStoryboard storyboardWithName:@"LaunchScreen" bundle:NSBundle.mainBundle];
[launchScreen instantiateControllerWithIdentifier:@"yourIdentifier"];
[NSBundle.mainBundle loadNibNamed:@"SomeXibOrNib" owner:self topLevelObjects:nil];
In your example you try to load via the NSNib
method but you obviously meant the NSStoryboard
LaunchScreen.storyboard
With your code it is in fact looking for a Nib called "LaunchScreen.xib" or "LaunchScreen.nib" which the error tells you does not exist.
and your 2nd Question.
If your info.plist contains a proper entry for a MainStoryboard and this Storyboard is setup correctly, it will instantiate your Window with a ViewController as Root that was given.
Which means after the "Main" Window is loaded from that Storyboard you can access its rootViewController
property asking for its ViewController in charge.
UI/NSViewControllers come usually with a corresponding NS/UIView for free, but because subclassed Controllers may be different a typecast is needed to get rid of the warning telling you that. So to make sure the variable rootController will hold a pointer to an object of ViewController that has a property view it is typecasted.
Which works because the given RootViewController is of type "ViewController" and very likely a subclass of NS/UIViewController.
Typecasts also express you know the inheritance works because you guarantee that a view property does exist at runtime.
PS:it is always a bit confusing when chosen classnames are very simplified without any further indication which one is meant. ViewController could have been named "ANViewController" which will help you in larger projects when you have a lot different ViewControllers.
Related Topics
Manual Language Selection in an Ios-App (Iphone and Ipad)
Looping a Video With Avfoundation Avplayer
Using Ssl in an Iphone App - Export Compliance
How to Detect the End of Loading of Uitableview
Get a List of All Contacts on Ios
Making Text Bold Using Attributed String in Swift
Getting iOS System Uptime, That Doesn't Pause When Asleep
How to Test Apple Push Notification Service Without an Iphone
Can Afnetworking Return Data Synchronously (Inside a Block)
Detecting Sheet Was Dismissed on iOS 13
Positioning Mkmapview to Show Multiple Annotations at Once
Drawing Uibezierpath on Code Generated Uiview
How to Save Local Data in a Swift App
How to Add a Border Just on the Top Side of a Uiview