using a storyboard from another project - objective-c

I am working on an Iphone Application, and I want to get a storyboard from another project.
I added the storyboard and all the viewcontrollers and images to my project (I copy Paste them from the other project)
Then I set it as the main storyboard in the info,plist file.
I get no compile errors or warnings however if I try to run the project I get a signal SIGABRT error.
(If i return to my original storyboard the app runs normally)
Any idea what might be causing the problem?
Thanks a lot for any help

Have you wired all storyboard object to proper ViewController ?
I often forget wiring delegate =)

In the summary tab make sure that the main storyboard is selected under "project name"/summery/ iPhone/iPod deployment info

Related

NSViewController loadView loaded the "(null)" nib but no view was set

I am hoping that someone else has run into this problem before.
In an Xcode Cocoa Application project I create a *.xib file with a single view, and some random sub views. I create a *ViewController.m and inherit from NSViewController. I set the file owner in the *.xib to my controller and set the outlet view to the main view. I then create a new controller instance in the AppDelegate's applicationDidFinishLaunching: and add its view as a child to self.window.contentView.
Here is the weird part... this works JUST fine in a fresh Xcode Cocoa project. The view from the *.xib is added to the main window as expected. However in the project I am currently working on I get [NSViewController loadView] loaded the "(null)" nib but no view was set no matter what I do. At one point in time this worked in this project, it now errors every time. I have even reverted the entire repo from an old Git commit! I assume i'm seeing an Xcode bug?
EDIT More info:
This seems to be connected to having the project as a child of another Xcode project. If I open the project individually (Rather than the parent project) it runs as expected.
I had a similar problem: I wrote a ViewController then added a xib and changed the File's Owner there. Then I added a ViewController object in my MainMenu.xib and changed the Custom Class of this object to my ViewController.
What I forgot and what caused the same exception: In the MainMenu.xib I had to click on the ViewController object and in the Attributes Inspector I needed to specify the Nib Name which should be loaded when the ViewController gets created. Sadly Xcode needed a restart for getting my changes.
Anyway, I hope this helps everyone who checked every view connection twice but still got the exception.
Although not an explanation of why it was happening, I found out how to fix this. I changed the entire project over to a workspace and my runtime error vanished. Originally it was a parent project, with 2 children projects.
Well knowing well that this code SHOULD work.
I did a simple experiment.
I simply recreated the xib for that particular item and the issue went away.
So IMHO this is a bug from apple.
I sure have a long list of them piling up here and there.
...
This whole thing started after i noticed very slow performance on the NSCollectionView, originally i had the cells into their own nib, but it appears this is not needed anymore, since you can define the custom NSCollectionViewItem in the same xib as the NSCollectionView.
Cocoa will then call a copyWithZone: and will be fine.
I guess my fault for not having adapted to some of the new patters from Apple.

Integrating a Nib based SQL3 Lite project into a tabbed bar

I have been looking around for a while and finally found a SQL Lite tutorial that perfectly suits my needs. I downloaded the source code from it.
This code however had plenty of depreciated code that I in turn fixed. Here is a link to my updated project. (HERE)
I have had quite a bit of experience integrating xib based projects into a tab bar project. But I'm stuck right at the beginning because in just about every file in this project there is a reference to SQLAppDelegate which is the app delegate of the SQL Project.
The problem I am having is that I have a storyboard project and already have an app delegate. If I included the code from SQLAppDelegate.h and SQLAppDelegate.m in my AppDelegate.h and AppDelegate.m of the storyboard project and include the code from RootViewController in the Tutorial project into my storyboard tabbar project view controller files and deleted RootViewController.xib and kept the rest of the files in my project, would that work?
E.g I would get rid of SQLAppDelegate.h and SQLAppDelegate.m and MainWindow.xib in the tutorial and integrate that code into my storyboard Appdelegate.h and AppDelegate.m.
Then I would take all the other files in the tutorial project and include then in my project with the correct frameworks. I would delete RootViewController.xib and keep RootViewController.h and .m , Then I would Integrate the setup of RootViewController.xib into my Tab I wanted it in my Tabbar storyboard. and make the correct references to it.
I would call that tab RootViewController in my storyboard.
I know I can include .xib files in my storyboard tabbar project and reference them from my storyboard. It works I've done it.
Would including the code inside SQLAppDelegate into my AppDelegate interfere with the code in the rest of my tabs?
Or can I just include SQLAppDelegate and the rest of the files into my project and reference them then delete MainWindow and _window code from my project and then make the relevant in my tab storyboard project connect to SQLAppDelegate?
This mite sound a bit confusing?
UPDATE
Okay... after trying to integrate it myself I came across a number of issues like
SQLAppDelegate *appDelegate = (SQLAppDelegate *)[[UIApplication sharedApplication] delegate];
Does not work in Arc and all in all I got about 10 errors and all I did was include the files within the tutorial project in my Storyboard tabbar project.
Who would have thought trying to use SQLite in a Storyboard Tabbar project was so difficult?
Is there any example of a Storyboard Tabbar Example out there that uses SQLite in one of the tabs?
The functionality of this project was so perfect. Sigh.
I found a Christmas Kepper App from raywenderlich.com/6603/basic-security-in-ios-5-tutorial-part-2 . A great tutorial, I downloaded the tutorial and aside from a few lines of depreciated code and 1 warning which I managed to fix, It works perfectly for what I want. :D

Missing proxy for identifier UIStoryboardPlaceholder [duplicate]

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
Hi I seem to have stumbled upon weird thing while developing a storyboard app.
My app is halted right after splash screen and in console I get error message:
Missing proxy for identifier UIStoryboardPlaceholder
Now, if I try to let the app continue running, I get new messages into console, which I believe are related to the fact, that there is something wrong with the first error message
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<IntroViewController 0x6e35f40> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key sceneViewController.
What is strange I get this error only when working with iOs 5.1 Simulator. It works fine on iOs 6 simulator and also on devices with both iOs 6 and iOs 5.1
I tried to find answer, but google says it could not find any results for the word UIStoryboardPlaceholder, let alone the whole error message. I made sure, I don't have the word 'UIStoryboardPlaceholder' anywhere within my xcode project(not even inside nib files) and also there's nowhere mentioned 'sceneViewController'. Any idea what might be wrong?
EDIT: I tried to reset simulator and cleaning project, but to no avail
We had the same problem: a view controller in a storyboard file with its interface defined in a separate XIB file. (Using Xcode 6.3.1, iOS 8.3 and Swift 1.2.)
We are using Swift so we had added the #objc() declaration to the class declaration:
#objc(TestViewController) class TestViewController: UIViewController
We could instantiate the view controller just fine from another view controller using self.storyboard?.instantiateViewControllerWithIdentifier( "TestViewController" ) but when presenting the view controller (using self.presentViewController( viewController, animated: true, completion: nil )) the app crashed with the same "missing proxy" and "not key value coding-compliant for the key sceneViewController" error.
Our solution which we found after much frustrated trial-and-error-like debugging was simply make sure the view controller's Storyboard ID in the storyboard file is not the same as the class name.
When we renamed the Storyboard ID from "TestViewController" to "testViewController" (only difference being the lower-case first letter), everything worked…
Strange? You betcha, but everything seems to be working now.
I had the same problem. Try cleaning the project and restoring the simulator.
I was getting the same error with an app that I was converting from .xib files to storyboards. My app contained a UITabBarController, and tapping on certain tabs would trigger the error.
In my case, the problem was that I had copied view controllers into the storyboard that used the "NIB name" property to load the view controller's view from an external .xib file. Storyboard view controllers do not support loading views from .xib files, so my storyboard contained a view controller that had no view.
I opened the external .xib file, copied the view, pasted it into the corresponding view controller in my storyboard, and made sure that the pasted view was subordinate (indented under) the view controller in the storyboard scene. Then I re-connected the view to the outlets in the view controller.
When I re-ran the application, the error was gone.
Add me to the list. I get this error after "refactoring - rename" on a class. The class I am renaming is a custom ViewController with its own .xib. I use Storyboard which launches a viewController containing a "Container View", which has my custom ViewController embedded in it upon launch.
The only way out of this so far is to NOT use my refactored .xib (disconnect it from the container view).
My semi-solution:
I have restored my app from a prior working snapshot and created a new custom ViewController and .xib from scratch instead of refactoring. Connected it to Storyboard and I got the error message again. Cleaned the build and deleted the app from the simulator and re-ran, and then it magically ran without error. For this reason I believe there is a bug in Xcode with Refactor-Rename, which corrupts some storyboard file behind-the-scenes. Once I confirmed that the new .xib was attaching to storyboard without error, I copied/pasted the class code into the new custom viewController class, and went through the process of reconnecting the class objects to the .xib, as you'd expect. Ran it and everything still worked.
FYI - here are some of the FAILED steps I took in my attempt to recover from the error (before giving up and restoring snapshot).
1. Cleaning Build.
2. Deleting App in iOS simulator.
3. Deleting all views in the custom ViewController .xib.
4. Naming the custom ViewController something else.
5. In Storyboard, adding a blank view to the ViewController representing my custom Viewcontroller class. This worked and allowed my app to run, however my custom class was neither able to load its own views in place of this default blank view, nor were it's own views visible upon making the default blank view transparent. Debugging showed my custom class .xib views being nil when assigned to self.view.
I am presently avoiding Xcode's Refactor-Rename for files having a .xib.
I had the same errors, finally solved it.
My problem was that I had :
[[storyboard instantiateViewControllerWithIdentifier:#"TripDetail"] methodThatDoesNotExist:#"param"]

Xcode, can't find my class which I had created

I'm playing arround with Xcode (for iOS) and added a View Controller to my Storyboard. Now I've created a Class (File -> New File -> Objective-c Class) and made that a subclass of UIViewController. Now the .h and .m files are generated and listed on the left side in Xcode, but when I want to change the "custom class" of my added View Controller there is nowhere my class which I had generated. Am I doing something wrong?
Thanks in advance.
I've had the same problem. Quitting and opening Xcode will make the Class show up in the list.
edit: I've also recently found pasting the Class name will work in 5.02 Xcode.
I had the same problem. But I discovered that I was clicking inside the "window of storyboard" and was selecting a view, so with no viewController related to. My solution was: to click inside the owner, or the viewController from the left list, and then change the custom class.
There are multiple reasons and solutions....
#1
Select project icon in "Project Navigator".
Then go to your Target's Build Phases -> Compile Sources.
Finlly, click the + button, and add your *.m or *.swift file.
#2
In one case, the same file was added multiple times to project:
Remove all instance of the file.
Add file back to project (once).
Finally, select the file in "Project Navigator", and in the "File inspector" on the right, look at the "Target Membership" section. The app target (not the Test target) should be checked, similar to this:
#3
ANOTHER WAY IS
Save all my work;
Just quit Xcode & load it again;
Then I was able to insert the new outlet connection successfully.
#4
Close the project you are working on with.
Delete the【DerivedData】folder of you project.
Said folder may be:
Inside your project's folder,
Or, inside ~/Library/Developer/XCode/DerivedData/(your project)/
Or, somewhere else that was setup by you.
Restart you project.
#5
Simply Clean your Project,
Then Build Again,
Finally, check and/or run.
I'm not sure what you mean by " but when I want to change the "custom class" of my added View Controller there is nowhere my class which I had generated ". It seems like you are trying to make the UIViewController in your storyboard to be of the same type of your custom UIViewController subclass.
If that's the case, then select your UIViewController (make sure you're not selecting the UIView within that UIViewController)
With the UIViewController selected, open the right hand view and open the Custom Class tab, then start typing in the name of your UIViewController subclass.
If that isn't working, then you need to ensure that the in the .h file you say:
#interface MyCustomUIViewController : UIViewController
If it still isn't working, ensure that in storyboard you are selecting the UIViewController that you put down. If you are trying to fill in the Custom Class of a UIView with a UIViewController subclass, it shall not work!
If it all still doesn't work, try COMMAND+SHIFT+K, and COMMAND+B to Clean and Build!
Good luck.
Just a quick advice in case you are about to give up: Do check that the item you have in the storyboard is compatible with the custom class you created that you are trying to assign. For example, you cant choose a UIView based class if you have a UIImageView as a component in your storyboard. In that case, it simply wont appear in the dropdown list.
You don't have to completely quit Xcode. Just close all your Storyboard tabs completely and reopen a new tab by double clicking on it.
Solution for my situation - just close all other xCode windows (i got opened few projects at same time).
Also sometimes help cleaning of project.

IKImageView Causes App to Crash

I am new to ObjC. Thanks in advance for your help and patience!
I'm trying to add an image to a window in my app (This is OSX, not iOS). I added an Image View (IKImageView) via interface builder to the window. I then added my image to the XCode Project and assigned it to the view.
When I try to compile the app it crashes with the error: "cannot decode object of class (IKImageView)".
The moment I delete the IKImageView it compiles just fine.
My initial thought was that I wasn't importing the required file, but this appears to be a subclass of NSView, so that shouldn't be the problem.
Any thoughts as to what I'm doing wrong?
Select the project on the left side of Xcode.
You will see the "summary" tab on the right side. Select it.
Add Quartz.framework into "Linked Frameworks and Libraries".