add an Xcode project to an existing one - iphone

I want to combine two Xcode projects into one app. I have project-one which is working fine and project-two w/c is also working fine. project-one is more like of an ebook gatherer and project-two is the ebook reader. The two works fine separately. I drag and drop project-two into project-one and add project-two as dependency for project-one. I get no errors when building the app and It runs normally until I open a tab(the whole app is a tabbarcontroller).
I have a 'books' tab and when I tap this, I want to run project-two in this tab. I tried calling the nib from project-two to load when the 'books' tab is tapped but it gives me a warning 'Unknown class RootViewController in Interface Builder file.'. So how can I successfully link the two projects so I can load project-two in my 'books' tab?
Thanks!

Despite the "Unknown class MyClass in Interface Builder file." error printed at runtime, this issue has nothing to do with Interface Builder, but rather with the linker, which is not linking a class because no code uses it directly.
“Unknown class in Interface Builder file”

Related

Why aren't my custom classes appearing in the dropdown in Interface Builder?

I am using Interface Builder and Storyboards to build my app. I am trying to connect my source code to my UIViewController in Storyboard, but none of my classes show up in the Custom Class dropdown menu. This is occurring in Xcode 11 beta 2 and Xcode 11 beta 4.
I've tried some solutions in this Stack Overflow answer, but they are not working. I've already done all of the following:
Relaunched Xcode
Deleted derived data
Reinstalled Xcode
Tried a different Storyboard
Recreated the UIViewController file
Made a new project (the problem even occurred there)
Typing the UIViewController name into the dropdown menu text field
None of the solutions worked and I have made sure that I was connected a UIViewController to the Storyboard not something else like a UIView. This is occurring with all of my UIViewControllers and UITableViewControllers.
(I wish I could show an image but I do not have enough reputation...)
I expected the UIViewControllers that I have created to appear in the custom class dropdown. I also surprised to find out that manually typing the view controller into the text field does not work. Instead, when I run the project, I just get this message in the console:
Unknown class ViewControllerName in Interface Builder file.
It appears that your classes aren't added to the project target. Try this:
1) Make sure your classes are added to the right target membership on the Inspectors Panel on the right:
2) Make sure the class inherits the View Controller type:
class CustomViewController: UIViewController
3) Reload xCode and check if the class is enabled:
It happened to me and I've noticed the Class dropdown was showing classes from another project that I have opened in the background. After closing all the other projects, the drop down finally showing the correct list of classes from the project that I'm working on. Seems like an Xcode storyboard editor bug.

How to add a downloaded widget to the Objects box in Xcode

I'm writing my first iPhone app. I needed a custom switch (I want it to say "Male/Female" rather than "On/Off"), and I found RCSwitch but I'm having trouble figuring out how to integrate a downloaded widget into my project. I assume this is a fairly common thing to do, but I can't seem to find any documentation online on how to use a downloaded widget / class.
I have succeeded in adding the code in via Build Phases -> Link Binary with Libraries. An RCSwitch directory appears within my project tree, and if I do a diff I see that it has added code related to RCSwitch to the header files.
The problem is getting the widget onto the .storyboard image. The RCSwitch widget itself does not appear in the "Objects" box -- the one that is by default at the lower right of the screen and includes images of the widgets that you can drag into the storyboard. Perhaps I'm missing something?
from the xcode 4 transition guide (pg. 65):
Drag a custom view object from the library into the nib file.
After adding the custom view to your nib, select the custom view and
assign the correct class to it in the class field under Custom Class
in the Identity inspector
Some more resources:
iphone-creating-custom-objects-for-interface-builder
Interface Builder Help - Custom Object

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.

iOS project not showing Interface elements built from Interface Builder in my view

I am working on a project which includes many UI components on one view(being built in Interface Builder). I have found that after saving and moving my project directory, the interface which should include all of these elements, is empty(there are no visible UI components in the view).
There are actually 2 projects. 1 is a framework project, the other is the iphone project which i build & run on the device - everything is contained within a folder which i may move frequently as other members in my team work on it.
the view which is not properly showing elements, is an XIB file which can be modified through either the iphone project or framework project.
Why is this happening and how can i troubleshoot this problem further? I am not sure how to fix it.
Many components will not show if they're not been connected to a property, and some will not show if their datasource or delegate is not connected.
Have you wired everything up, making all of your connections?
Could you check the view hierarchy in the -(void)viewDidLoad ? As Matthew said, if those components are not connected to properties, they won't be shown. And, if they are not add onto proper view, then they won't be shown too.
You can check the view hierarchy of viewController by browsing the property subViews of self.view.

Recreating a Duplicate iPhone Project with Interface Builder Errors

Due to some extraneous errors in a previous XCode project that wouldn't allow my iPhone app to run on the iPhone, I had to take all the code and files from what we'll call Project1 and build a new project called Project2.
I then filled Project2 with all the same files, not changing any code.
Next I had to recreate the Interface Builder files. As far as I can tell, this was done with the exact same classes declared in all the IB objects.
However, when I build Project2, it only shows a visible black screen and doesn't display the app.
The one difference I have found between the two projects is that in Project2's Interface Builder, the ToolbarController outlet is not even available for the view, and it is in Project1. I am assuming the lack of connecting the File View to ToolbarController is the problem.
Why is ToolbarController (as shown below) not available and how do I fix this difference?
Below are two screenshots. The first is Project1 and the second is Project2. :
alt text http://img32.imageshack.us/img32/8296/picture1xne.png
alt text http://img51.imageshack.us/img51/4194/picture3to.png
You've probably got the "File Owner" (or the "Toolbar View") set to the wrong class. Interface Builder doesn't see any outlets or actions in the classes you have set currently.