Warning while creating outlets for NSTableCellView - swift

I am having problems with this tutorial that I cannot understand:
http://www.brandpending.com/blog/2015/6/24/creating-a-custom-layout-nstablecellview-table-columns-with-a-storyboard-using-swift
This tutorial initially works fine. However, to try to better understand the differences between an XIB and a storyboard, I tried to create the custom NSTableCellView layout using an XIB. I couldn’t make it work.
I successfully followed the instructions on the web site until I got to step 4. I found I could not control-drag the text and label fields to BPTableCell.swift.
After more research, I added an Object to the Objects section of the XIB file and set its class to BPTableCell. I was then able to control-drag the controls to it and create IBOutlets. However a there was still a problem - there are now two warnings. The warnings read
MainMenu.xib: warning: Unsupported Configuration: Outlet 'itemField' of 'Table Cell' is connected to 'Item Field,' an invalid destination (Object may be repeated at runtime.)
MainMenu.xib: warning: Unsupported Configuration: Outlet 'itemLabel' of 'Table Cell' is connected to 'Item Label,' an invalid destination (Object may be repeated at runtime.)
I’ve googled these warnings but cannot find anything helpful.
Can someone please tell me what to do to get rid of these warnings?

The bindings are invalid because they connect to entries that are dynamically duplicated (so you'd have multiple objects connected to the same variable). This is not possible, hence the warning. But if you have a custom class for the view anyway you can access all objects from there. You can indeed bind subviews to vars in your cell/view subclass.

Related

Issue setting data for Radar Chart in iOS charts

I am using the charting library here https://github.com/danielgindi/Charts/ however I am having a couple of issues.
First, I have no idea how to set the data for a radar chart type and second, I have an error when apply the RadarChart to uiview. The error is
Unknown class RadarChartView in Interface Builder file.
The app still runs and I can see an empty uiview.
I have looked at the demo app and through the documentation but I am still unsure how to actually set any data to the chart.
Thanks
If you looked at ChartsDemo app, why you still not unsure how to use it? The code is straightforward. Otherwise I am still copy pasting code from ChartsDemo, which is meaningless.
For the class, you need to choose Charts module for your IB: https://github.com/danielgindi/Charts/issues/59
downloaded library
reembedded it with the option "Embedded Content Contains Swift Code"
In Storyboard where I defined the class for the charts view as "LineChartView", I also have to set the module manually to "Charts".

Unknown class in Interface Builder file

Why am I still getting this error when I run my iPhone app? The file is a ViewController that I have been working to delete and replace, but it just won't die. As far as I know, I don't have any reference (string or otherwise) to this file in my project.
I have deleted the related file (I'm trying to get rid of it.)
I have cleaned the project and rebuilt.
I have "Reset Content and Settings" in my simulator.
I have done a grep (grep -i -r "TheClassName" *) and nothing matches except my UserInterfaceState.xcuserstate file.
I have searched the code using XCode's Find/Replace tab.
I have double checked my Build Phases and am pretty sure it isn't in there (its a large project).
Any other ideas? I've spent way too many hours trying to figure this simple thing out; I must be missing something.
Thanks!
Check your nibs or storyboard, and make sure none of your views are set to the class!
I finally fixed the problem after trying it on multiple machines over the course of almost 2 days! I will not be thwarted!
I tracked the problem down to a call to setViewControllers on a UINavigationController which is called on initialization of the application. I was always being passed 3 objects (there are 3 panes in the navigation controller). Even though I had deleted the third object, as previously explained, three objects would always be passed in. The class type of the first two was correct, but the third would just be a UIViewController. Curiously, this view controller had a nibName which corresponded to the object file and Xib file that I had previously deleted. Of course, when view was called on this borked UIViewController, it would crash since the corresponding nib had obviously been deleted. Remember, the textual name of this object or Xib could not be found in my directory with grep, so I have absolutely no idea how in the world it came into existence when I ran my app.
So, I figured the app may not have been cleaned properly. I double and triple checked this. I even validated that my Workspace settings were correct (File->Project Settings->Advanced). The app was indeed being recompiled fresh every time.
Secondly, I started thinking that perhaps the object was being set by some other means. Working backwards, I added some breakpoints and found out that initWithCoder was being called on the parent UINavigationController--this was eventually working down to call the setViewControllers on the object and assigning the three view controllers (one of which was the offending one). I could easily see from the call stack that the Nib file that was being loaded was deserializing something offensive.
So, I started digging into my Xib file. Of course, the object name wasn't in the file (as expected since the grep didn't find anything). I deleted and recreated the portion of the Xib that included my root UINavigationController. This ended up changing the Object ID and ref within the Xib file.
Secondly, I created a new Xib and UIViewController with the same names as the one which I had previously deleted, hoping that Xcode might be happy if I created and then re-deleted them. I then compiled, re-deleted them, updated by Xib file yet again, reverified with grep that yes, indeed, nothing existed with that name.
And it worked. After spending multiple days on this issues, I'm fairly sure that there is a bug here in the interface builder, but do I want to revisit this problem to file a bug report? Absolutely not...
In my case, I solved an issue by name of Custom class name of View instead of Custom class of ViewController. By mistake i added like this for view as shown below.
It Should be for ViewController like this.
This is in my case, for you may be it's related with another component.
This happens when the view class is in a framework. Select the framework's module. Example with a CocoaPod: HSegmentControl.
Make sure when you add or rename or move files around especially in folders, that when you add them you:
A. Create Groups, not references they don't usually read in.
B. Check the boxes for the apporpriate "Product(s) or Target(s)" you want to add the source to.
Another thing to try :
I had to toggle "Inherit from Target" under the "Module" control of "Custom Class."

Table showing up in storyboard but not when running the app

I visually designed a table in storyboard, which displays six properties of an object. I can see the table in the visual editor, but for some reason, when I run the app, the table is not there.
Do I have to initialize anything, or ... ?
Here is screenshot
I know this is an old question. But I ran across the same problem and thought I would share the solution I found. When using the storyboard UITableViewController the implementation file autofills with methods and delegates for UITable. However, if you are using static cells you need to remove all of the implementation file table data source defaults (ie. numberOfSectionsInTableView, numberOfRowsInSection, cellForRowAtIndexPath)

Interface Builder shows old Received Actions

When I open my xib file in Interface Builder and click on File's Owner in the Document window, the Connections Inspector is showing far more actions below Received Actions than I have defined in the class as specified by the File's Owner Class Identity.
I have only two IBAction items defined in the class, and both of these actions are shown and hooked up to the appropriate buttons. I am not sure where these other ones are defined, as when I search the project for the text of the action shown, it is not found anywhere in my project. (I believe that the actions shown are from a previous software application that I did on this same computer.)
I cannot find any way to get rid of these, and while the application still works as it should, I would like to try to find a way to get these actions out of there.
I am using the most recently released iOS SDK 4.1.
You may need to just edit the xib file by hand and remove the invalid actions.

Console won't print, only "...unrecognized selector sent to instance 0x####XX0" Runtime Errors

I'm working on an iPhone app (first real programming project) and I had two views that would go into tabs in separate applications to build them, where they work fine. Then I added them back into the main project; The tableviews bring on a crash with an numberOfRowsInSection] unrecognized selector sent to instance 0xXXXXXX so I isolated the other view to fix any errors there first. I'm using xibs.
But on the other view, when I click a Button that triggers a custom method, I get an *** -[UIViewController methodName]: unrecognized selector sent to instance 0x####XX0 just like the last one.
What also puzzles me is that the console won't print anything else except these errors; I have NSLogs() all over the place and they're not showing up, even in the appDelegate. They do however show up when they're in the main. (Because of the application life-cycle right?: then the error gets there first and I don't see my NSLogs)
The unrecognized selector messages are logged because of methods. I have all my synthesize statements and have searched questions here, but they're not like mine (I think.)
When you say you added the XIB files "back into the main project" it makes me think this is the likely area of concern.
I think it may be the case that these XIB files are still thinking they are classes in the old application (where you originally built them). I suggest:
Opening up each XIB file and removing all the connections
Then check the class name of the "file's owner" and check that this is the class in your new application. If the class names are the same in the old app as the new, change to something else and then back again.
Hopefully this will sort it. If it doesn't, try creating a brand new XIB file and then building it in the same way as you built the others. If this still doesn't work the problem is in the class; if you let us know then we can come back with further ideas in this area.
Hope that helps!
I've since removed the second view from it's xib and instead put it in the main xib, with an added UIViewController object that has it's class set to my subclass. Now it's working, and I'm moving on to the next part. I think it was that I left out UIViewController in one way or another from the xibs
As stated above, almost everything being worked out now. Thanks though and silly me for posting such a question.