MainStoryboard disappeared after moving project folder - ios

I just tried to make a copy of an X-code project (perhaps ironically, for back up purposes) by alt+dragging to another folder.
Instead I accidentally just dragged it and X-code complained about this (I know, I should've closed X-Code before attempting to copy the folder) so I moved it back immediately.
X-code insisted it either re-save or close, so I opted for close.
When I reopened it, my MainStoryboard was gone (red typeface in the explorer).
Anyone know if it's possible to retrieve it?

Not much help to anyone but switching the Mac on and off again restored the file, which was a nice surprise.

Are the files in the project directory?
If so, you can try to delete them from XCode and re-add them to the project.
It could a problem linked to the localization. You should try to remove any other langages.
Do you use any souce management tool (svn, git, snapshots or Time Machine)?
If so you can maybe take a look at it to retrieve a recent version of the files.

Related

Xcode could not open file

I am making a mini tweet and working with team members using RxSwift and MVVM. But when I try to open a new file, it doesn't open. Restarting the computer and restarting the app is the same.
I'm working on the same branch as a team member, is that a problem? Why won't it open
NetworkingAPI and ViewModelType is new created file but The file color is weird
There are lots of reasons why that specific file went missing.
You might've dragged that file from somewhere into your Xcode project and you thought that it was copied properly onto your project folder and deleted it from the original source folder.
Merge issues.
Similar to #2, another team member of your project pushed the file in a wrongful way.
There are of course also ways to recover it.
Check your local machine.
Ask for the most updated file from your teammate.
Check your commits, and simply copy the whole source from there and fix it in your Xcode project by making a new file in your project folder.
I think the #3 should suffice.
You have the reference in Xcode but the files are missing.
This happened when merging and you had .xcodeproj conflict then someone solved it in the wrong way. Check this as reference: https://stackoverflow.com/a/12907864/3933094

XCode Source Control - Discard Changes Deleted imported files

I am doing a game for iPhone and iPad using SpriteBuilder. SpriteBuilder makes a couple of files in the same folder as the XCode project. I was using Source Control and I just made a commit, then I changed a little bit of the code in the XCode (I changed nothing of the spritebuilder files) and then I changed my mind and I wanted to go back to the commit I made. So I did source control -> discard changes. The XCode successfully replaced the new code with the old code but it erased most of my SpriteBuilder files!!
How do I get my SpriteBuilder files again?
Screenshot of the last commit. You can see that xcode knows when the spritebuilder files are changed so it should keep them no?
Unfortunately the way Xcode calls Git appears to do this. All may not be lost, however. Check the trash for your missing files.
Quit Xcode.
Open the file you wish to bring back your lost changes to using TextEdit.
Go to File -> Revert To -> Browse All Versions...
Scroll through the available versions. Hopefully you will have many available to choose from.
Select a version and hit Restore.
Follow 1-5 for all necessary files.
Launch Xcode. You should now see the M next to these files in Project Navigator indicating they include uncommited changes (the changes you previously discarded).

How does Xcode compile files when changes are made in a project?

I am new to iOS programming and Xcode. Please help me understand how does Xcode compile and run the code.
Ideally an IDE knows the changes made in the progranm and the next time when we compile or run it, it knows which files need to be compiled again. But while I was trying to add storyboards in a project which was working fine with a few ViewControllers and XIB files,
I moved the view from an existing xib file to a ViewController in the storyboard and changed the name of the class to its respective ViewController in the Identity Inspector and I deleted the XIB file. When I ran the program, I didn't see anything different happening. Out of curiosity I deleted all the XIB files and then again ran the program but the still the project ran perfectly.
Then finally I deleted all the files present in my project and when prompted to either "Send to Trash" or "Remove References" I chose remove references and again built and ran the application, but there was no problem and again it ran perfectly.
After that I closed the project and again opened the project from the 'Finder' and ran it this time finally I got more than 30 errors which were not resolved even after I added all the files back to the project in Xcode.
Please help me understand how Xcode compiles the projects and also that what I may be doing wrong to move the views in the XIB files to "Storyboard" in a project.
You are right in your understanding that XCode should detect changes and know when to rebuild things, however, XCode is not perfect, and is sometimes buggy. You can "Clean" the project under the Product menu to get it to rebuild.
You did not say if you were running on the simulator or not. I often have problems when adding or removing resources and running on a device. To fix these issues, you can delete the app on the device.
Restarting XCode also often fixes issues.
Also, ensure you have the latest version of XCode.
If you get to the point where you can recreate issues, consider submitting a bug report.

How can I avoid having to clean the project after replacing files?

Xcode 4.5.2, using cocos2d-iphone 1.0.1 for game development.
Recently, I have realized that every time I replace an image file with one of the same name, the project in my device will continue using the old one when I create a CCSprite with such file.
This can be fixed by simply cleaning the project.
However, now the project is rather large, and compiling after cleaning takes quite an annoying amount of time.
Is it possible to replace files and make Xcode use the correct files instead of having to clean the project?
Another simple fix is to give a different name to the new file and delete the old, then change the CCSprite to use the new file name. Of course, this is ridiculous so I'd like to avoid doing it.
I believe that it also happens even when I just delete the app from the device - it seems I do have to clean the project.
Open Organizer in your Xcode. Goto the Projects tab.
you can see Derived data options. Click Delete near to that option, to clean your project

Why is Xcode 4 not running my latest build?

I was originally working from my desktop on a project. I then decide to continue working on the same project over at a friend's house. I come home and decide to use the newest project (on a different folder even) open the project I run it and it shows the same thing I had before... for some reason it appears nothing got updated.
Any ideas why this is occurring?
You might try cleaning the project (Command-Shift-K) to see if that helps. I usually have to do this when I don't change code and only change a resource such as a xib or image file.

Resources