We try to create a new project at Xcode. We create it and put some buttons on View on storyboard. When we execute project it executes an old project. What Im thinking is in Java there is a thing like set as main project is there anything like this in Xcode? Moreover if not what might cause the problem of this. It shows different buttons in storyboard and in execution it opens old project :S. I didn't like Xcode to be honest but I have to :(
Your project will have a file called -Info.plist. If you open this you will find and entry with the name of the main storyboard. This should be the storyboard you are editing. If it is something else that would explain the behaviour you describe.
Related
enter image description here
Im a noob when it comes to this but, I wanted to show the storyboard file that I made instead of the "Hello world" when I launch the app. Pls Help..
You created a SwiftUI project in your screenshot. That's why you have code instead of a storyboard file.
The fix is to choose Storyboard from the Interface menu when creating the project. Then choose File > Add Files to ProjectName to add your storyboard file to the project. Xcode defaults to using SwiftUI for new projects so you have to explicitly choose Storyboard to use storyboards for your app's user interface.
If you don't see the Interface menu in the second step of creating the project, make sure you didn't select a Multiplatform project. Multiplatform projects don't have the option to choose a storyboard for the user interface.
I am working on an iOS project but mistakenly I just remove reference of the whole project in Xcode. After that, I have tried to add all of these folders and files but now the scheme is gone that's why I can't build the project anymore. Can we fix this horrible problem?
This is an ugly work-around, but it has been known to work.
Start a new project with the same name (just stored in a different place)
Remove all the code from the project navigator, including the storyboard
Import all the files and the storyboard from the original project.
Double-check the storyboard (I had problems with loss of segue IDs)
It took time, but at least it made the codesign problem go away.
This is a real 'WTF?' moment for me.
I copied some classes out from another project, including copy and pasting the code and some UIBulder components. What did NOT get copied was the XIB file (I went from XIB to storyboard).
My tab / swipe recognizers aren't activating, and when I drill down the only thing I can discover that can explain it is that somehow, someway, I'm hooking up against the XIB file. (When I click on the little button next to the IBAction/IBOutlet lines in the header, it shows me both the storyboard and the xib file as connected).
I'm not referencing that file anywhere that I can find, it's just somehow magically recognized in Xcode. I don't know what to do, how to fix this.
Anyone have any ideas?
Edit: The really annoying bit is that the file doesn't appear to be in my files list when I check there, I can't just delete the reference that way. And since it's referencing the file in the original project, I can't just delete it. (Any changes made in either project cause changes in BOTH projects; their both using the same xib file for some reason). I should be able to simply delete the reference to the xib file, but I can't find the reference.
If you copy the view controller code from one project into another project you will notice a strange thing happening with the outlet. It is referencing the view from the first project without you ever connecting any outlets.
If you left click the little circle and click the reference link you will even be taken to the storyboard view in the other project. Trying to figure out how to get rid of this reference can drive you crazy.
Well, the good news is that there is really nothing for you to fix. You didn't copy over some deep, hard to find referencing link. Xcode is just getting confused because the View Controller and the outlet name are the same in both projects. Basically just ignore what that little circle says. You can close the first project and Xcode will figure things out eventually. Right click your views in the storyboard to see what referencing outlets really exist in the current project. (See my fuller answer for more details.)
No need to delete Derived Data. That doesn't solve the problem anyway. Just try opening both projects at the same time again and you will get the same strange behavior.
The way I figured this out was to separately create two new projects that had view controllers with the same name and a referencing outlet with the same name. I never copied anything but Xcode showed one was referencing the other. Like I said, ignore the little circle.
I just had the same problem. What solved it for me was to close both projects, delete the derived data from both and then reopen the destination project.
I agree, it's a crazy problem.
I'm sure that this problem could happen and I fix it deleting the content of the Derived data folder of XCode.
I just want to add the steps of how to delete those files:
Don't Delete the DerivedData folder.
Go to preferences (Command ,) > Locations Tab
On Derived Data you are going to see the path, clic the right pointing arrow (that will open that location in Finder)
Close XCode
Select all the files inside the DerivedData Folder (do NOT select parent folder) and (Command Delete) or move them to the Trash and then Empty Trash
Open the project and you are done
I hope it helps someone
unless the xib file is in the project. it should not have a link to it.
the xib file connects to the .h file. not the other way around.
You may want to remove the connections in the storyboard and re-connect them.
Also make sure that the storyboard is the UI being started and that the item on the navigation stack is actually the storyboard page. But you should be able to connect both the storyboard and the xib file to the class at the same time. You just cannot connect one IBOutlet to more than one object in a single ui component (e.g. two buttons on the storyboard cannot both be connected to #property IBOutlet UIButton *myCurrentButton you must have a separate IBOutlet for each connection. On the other hand, any number of actions can be connected to an IBAction. which is why you get (id) sender on each action.
I dont know if this is exactly what you are experiencing, but I hope that understanding helps you debug your issue.
I need to add an external project to my Xcode project, the reason for this is I need to add a Target Dependency on that external projects static library.
I can't seem to add it in the way I need, I would like it like this:
However, when I add another project to my actual Xcode project I get the following which doesn't let me explore that project from my one and so I can't add the dependency I need.
Note that these screenshots are from two different projects, and in the one which is showing me what I want to reproduce in my own project, dragging in multiple projects works as expected.
Maybe I have some settings set up wrong in my project ? All I've done is take a template detail-master application from Xcode.
You did it right. The problem is that Xcode cannot have the same project opened twice.
Close Serenity.xcodeproj before reopening your parent project.
Yes, this is possible, it's called a workspace.
In your example:
Open both of your projects
Drag the Serenity project into the Dependant project
I think what you are doing wrong is dragging the Xcodeproj, try opening that project and dragging the project block instead (see pic)
I have been working with Xcode 4.2.1, but following some tutorials and videos from the earlier version of Xcode.
As usual I had the problem with the Windows Based Application. I created a empty application for my Windows Based Application project and was following some steps from the same forum of how to add a MainWindow.xib file to my project using this post
There is no .xib file when I create a new "Empty Application" in XCode
I also followed one more post which has some good screenshots:
http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
Now my problem is I cannot ctrl+drag of the window outlet from the App Delegate object to the Window object. The reason is I could not find out the window outlet from tze attributes menu. One can see the screenshot of how it is looking in my xcode:
And below one can see how it should have a windows outlet for the App Delegate.
Is there anything I am missing or left something behind before coming there. I followed the steps exactly as mentioned in the above posts. I tried creating new projects just to make sure Im doing everything correct.
Any information regarding this would be appreciated.
Thanks
Raaks
From your tutorial..
http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
The answer to your problem is Simple(and also this is the way you should do most of the time in future..)
1) Click on File's Owner(In the placeholder section..left to the xib).
2) In the attributes section you will see a window Outlet..
3) Drag window from the attributes section(right click-drag or ctrl-drag.) and drop it on window in Objects window..(left to the xib)