Problem such, downloaded and installed MWFeedParser, it worked all right, but that's a problem, I do not need that to show a list of the main xib news, and that he would need to show the menu that I create. But when you try to add a menu, ie create a new a new xib, I choose in the settings (general) in paragraph mainintarface, choose your new xib (MainNav) I get an error
libc++abi.dylib: terminating with uncaught exception of type NSException
Dig deeper into the net, I came across this response, I understand the problem is that I have not added my new xib in UICollectionView? I porobyval remove UIKit.framework, then got out unreal number of errors. Well, actually the question how do I add my new xib in UICollectionView?
You need register your xib cell to your UICollectionView on -(void)viewDidLoad of your view Controller.
[self.collectionView registerNib:[UINib nibWithNibName:#"nibName" bundle:nil]
forCellReuseIdentifier:#"cellIdentifer"];
Click [here] (https://github.com/lequysang/TestCollectionViewWithXIB")
Related
I have a simple UITableViewController subclass, that shows different cell prototypes.
I've also added a UISearchDisplayController to manage the search, unfortunately if I try to search something it crashes.
This is due to the fact that I'm trying to dequeue a cell that was not registered in the UITableView owned by the search display, and I understand that.
Is there any way to easy register one without (solutions already proposed on different SO answers):
creating another cell xib programmatically equal to the one already loaded
registering a new class or a nib
hacking things that could be easily broken in future releases
dequeuing cell for the first table view and creating new for the search table view
I've tried to find a property in UITableView that list already registerd nib or class to pass the info to the search table view but it doesn't exist
I am doing a UICollectionView project but I didn't use storyboard to manage the views. I subclassed a UICollectionViewController in MyCollectionViewController with a MyCollectionViewController.xib file created. In the xib file, I dragged a Collection View onto the view, as the figure shown.
I believe that the grey boxes are the Collection View Cells and I am supposed to click on them and change their Identifier so that these two lines of code recognize this is the cell.
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:#"CollectionViewCell"];
UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:#"CollectionViewCell " forIndexPath:indexPath];
However, I couldn't click on the cells neither can I drag a new Collection View Cell onto the Collection View. I am getting the error message like this:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier CollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
Can someone help me?
I figured it out.
The reason was I have used duplicated cell identifier: #"CollectionViewCell".
Change it and everything is working perfectly!
So, be aware of the identifiers! Make sure that each one is unique and don't even mess up with class names. Hopefully this can help out some people who have the same problem as me.
New to Xcode here -- Is there a way to get more detail out of Xcode when it runs into a compile time error? The only message I get when I try to build my application is "Interface Builder Storyboard Compilation Failed". I have no idea what file it's having a problem with.
Nothing additional turns up under the "Build" item in the Log Navigator either.
Thanks to wufoo I figured mine out.
I have a tableview that has five static cells. The cells have an assortment of UIImageViews, UITextFields, etc. I had created IBOutlets in the main UITableViewController .h file and connected directly to the static cells UITextfields in the storyboard. You can't do that.
Once I removed those connections it compiled fine for me.
It appears you have to connect UIWidgets (textfields, labels, imageviews, etc) in a statically created cell directly to IBOutlets in that cells .h file (NOT, as I did, to IBOutlets in the tableview .h file).
---- UPDATE ----
Ok, so my initial post was not entirely accurate. It appears you CAN connect IBOutlets from subclasses of UITableViewCell directly to the main UITableViewController .h file. You just have to make sure that you set the Table View Content field to "Static Cells". I missed that step.
Here is an image to illustrate:
Select your storyboard, in the detail pane on the left, ensure that your "Table View" is selected. In the pane on the right select your attributes inspector panel and change from "Dynamic Prototypes" to "Static Cells". Setup your static cells by dragging and dropping your components onto the storyboard, then if you want to link from your components directly to IBOutlet properties on your main ViewController .h file you can.
I discovered the issue I was having was that I set up static cells in storyboard, and then tried to recreate them again dynamically in the delegate method cellForRowAtIndexPath:. That does not work very well. If you use static cells you do not need to use any of the cell setup delegate methods.
Here is some excellent reading that also helped me out:
Apple TableView Programming Guide
For what it's worth, the problem seems to be related to two IBOutlet objects declared in my .m file. One was referencing a UISlider and the other a UILabel. I removed the references and then declared them as class variables instead. In viewDidLoad I hooked them up using [self.view viewWithTag:TAG_FROM_STORYBOARD_WIDGET]. Looks like the same solution as mentioned by
f.perdition in the link above.
For me, it was two identical storyboards in the project that lead to this error popping up frequently.
I created a storyboard X, added a view controller Y in it. Then I refactored a view controller Z to storyboard X. Xcode asked if I want to replace the existing storyboard X and I selected Yes.
Its only after a few hrs I noticed that there are two references for the storyboard in file / project navigator (left pane). Removed one of the referneces and the issue hasn't shown up after that.
In my use case I have added a new target that runs the build script that is using xcodebuild. I was receiving the same failures but the reason was Mac Catalyst support being YES by default in Build Settings. (My main target doesn't support Mac Catalyst.) Changing those to NO in Builds Settings fixed the issue for me.
I have a storyboard in a project I am working on, but recently I have noticed that I am having issues. Out of nowhere, my code is now telling me I need to register a class for a cell identifier
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier rootCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
(I have the cell prototype in the storyboard, so I don't believe I need to.) if I perform
[tableView registerClass:<my class> forCellReuseIdentifier:<identifer>];
it will get beyond that, but then it hangs up when I
[self performSegueWithIdentifier:<my ID> sender:self];
and tells me that it cannot find the segue. I was able to confirm the segue is setup with the proper Identifier in the storyboard.
Does anyone know what the problem could be?
I did a rename on the storyboard a while back, but I updated info.plist and I'm pretty sure it still worked after that.
If I re-create the storyboard in another project, it works fine, but if I re-create the storyboard in this project, it fails.
EDIT: I do have the class set correctly in IB
also this is a manual segue.
EDIT: Added exact error wording.
I just had this happen.
Had to add [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:#"WhateverCellID"]; in my viewDidLoad
I was using a regular viewController, realized my mistake, and switched to a tableViewController and started getting the same error.
Alternatively use 'UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];`
Without the indexPath option this is a different call, which doesn't require registration and may suit your needs.
If you delete the storyboard from your iPhone/iPad/Simulator or wherever you're debugging it, and then clean in Xcode, then build & run, do you see different results? The reason I ask is that each time you build in Xcode, you get a union of everything your project has ever contained. So if you renamed the storyboard, and haven't done a full clean, you likely have both storyboards in your built product.
When I make a new UITableViewController and click on the UITableView in the accompanying .xib file, I see this:
Notice the "Table View" section of the properties on the right. Specifically, there is no place to pick the 'Content' as Dynamic Prototypes, or Static Content, as with a UITableView in a UIStoryboard (below).
What gives? I can't think of any reason why these features would be Storyboard-only, am I missing something?
Currently it is a Storyboard only feature for now.
Hopefully Apple will make this very useful feature available to standard XIB files as well.