Storyboard will not save in Xcode - objective-c

So, for an independent programming class I am working in Xcode. I am using stanford's iOS development course to create a calculator. However, recently, the item mainstoryboard.storyboard has been unable to save. I removed the entitlement, which allowed the other files to save, but the storyboard has still been unable to save. I looked around on the internet a good deal, and all I've been able to dig up is that the file might be corrupted. What do I do for this? Is there anything I'm missing? I don't know what kind of context I should be providing, so please tell me if there's something you want to see.

Try to clean your derived Data and try to clean and clean the build folder (you do this with alt+clean).
If you can't save the file again try to create a new project create a storyboard. If you can't create it on this way then you have to get to the Apple Dev Forums there is a bigger Problem then.
But anyway if you create Storyboard the App only runs on iOS 5+ Devices. Not the best option imho.

Clean all targets, close Xcode, reboot your mac. Then restart Xcode and create a new iPhoneStoryboard.storyboard and try again!
I've solved in this way this problem!

You can delete the storyboard by clicking on it in the left pane and press delete button. When prompted choose delete rather than removing reference only. Then use command+n and in the popped window, choose storyboard and name it as MainStoryboard (Xcode will add .storyboard for you).

Well, as it turns out, it was a problem with not having enough memory on the server. I've been looking at all the wrong things and can go back to working on my program. Thanks for all the help, too bad it was something else.

Related

Xcode 6 Swift code completion not working

Using Xcode 6 GM seed my code completion has stopped working. It was working the other day. I was trying to get the unwind segue work around to work. I had made an Objc header file and assigned it as a header for a Swift class.
At this point I get code completion with an Objective-c project. But, not with a Swift project.
I have tried restarting Xcode, making a new empty project.
Just go in user->Library->Developer->Xcode->DerivedData and delete the Data of folder(Derived data) and restart Xcode.
This fix from apple dev forums works for me. I have had autocomplete issues with Xcode 6.1/Yosemite.
Quit Xcode.
Restart the computer (this is to clear any in-memory caches).
Delete the contents of the DerivedData folder (~/Library/Developer/Xcode/DerivedData), precisely run, a) cd ~/Library/Developer/Xcode/DerivedData/
b) rm -rf *
(Try this if Steps 1-3 dont really work as it rebuilds the cache later on restart which takes time) Delete the contents of folder ~/Library/Caches/com.apple.dt.Xcode, i.e., a) cd ~/Library/Caches/com.apple.dt.Xcode b) rm -rf *
Now launch Xcode once moreā€¦
I experienced a serious breakdown of code completion because I had some 'notes' after the #end statement of my .m file which were as follows:
/*
NSAlertFirstButtonReturn, NSAlertSecondButtonReturn, NSAlertThirdButtonReturn
*/
These lines can appear before the #end statement without destroying code completion.
There's an easier way to delete the Derived Data from within Xcode (no need to open finder or restart):
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
I just recently had this problem. Autocomplete did not work ...and when i typed for example tableView.... it did not give me the different functions available.
I tried the following and it worked for me.
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
delete the file ~/Library/Developer/Xcode/DerivedData/ModuleCache
Restart xcode
Hope this works
Another possible reason why it isn't working is because it's not part of the target membership. To fix this, select the file you're working on. Then, go to the File Inspector and in the Target Membership section, make sure your project is checked.
Try the following - as silly as it may sound:
Change Device to iPhone 6, close Xcode, Reopen Xcode and wait for the indexing to finish.
Go to Xcode menu, then Window -> Organizer, then select Projects. Pick your project and press on delete button beside dervied data
Then restart Xcode
That solution worked with me on Xcode 6.1
If your code completion problem is only with UI classes (e.g. UIImage, UIDevice), then you just need to add "import UIKit".
Swift files will NOT have code completion for UI classes unless there is an "import UIKit".
I had the same issue but under different circumstances,
I have 2 projects in my workspace
Swift framework for iOS and OSX
iOS Project (which uses the swift framework)
My code completion works fine in iOS but it keeps failing in the swift framework. I tried all the about solution and had no luck and was killing my productivity.
Finally i figured out the solution to this problem.
Select the file you are editing (in the framework )
Select the 'utilities' tab on the right
uncheck the Mac target (just keep the target you are working for
currently)
Thats it, this solved my problem.
hope it helps someone who is in this kinda situation.
user/Library/Developer/Xcode/DerivedData Delete all the files shown in this folder. after that go to your project name and clean project then come back to the file where you wanna see suggestions. Type any word and its done.
So all you have to do is make sure, in the file inspector view on the right side, under Target Membership, the first box is checked. I'm not sure why this changes things but I'm sure someone can come along and give a more complete answer.
In my case Some File(s) were deleted in File System but were still referenced in the Project i.e. in Red Color. Just delete those from Project and everything was fine. Code Completion started working.
Also Like to point that all the above answers about Clearing/Deleting Derived Data folder seems to work momentarily but whenever there was a new pull or update the problem started again, so the root cause was the unreferenced/moved/deleted files which show up as RED in the project, they needs to be manually cleared.

Undo doesn't function in IB (Interface Builder) in Xcode 5

Is anyone else having this problem? It was working a couple of days ago but now anytime I'm working in Interface Builder on a storyboard Undo simply says "Undo Change Frame Size" no matter what I do it doesn't allow undo/redo (this is VERY TEDIOUS!).
It also happened to me when I upgraded to Xcode 5 for some of my older projects that I've migrated. Cleaning the build folder didn't do any help. But deleting everything inside the DerivedData folder (/Users/(your username)/Library/Developer/Xcode/DerivedData) helped me. It works much like a cache folder so deleting everything inside it is safe (everything inside there is built from your project files anyway, they just speed up things). It's probably corrupted (or incompatible) with Xcode 5. Close Xcode, delete everything inside it, and reopen Xcode, build your project. It worked for me.
Note: If you are unsure about deleting the files in DerivedData, you can back it up to somewhere else before deleting it just to be on the safe side. But I can pretty much delete everything inside it with confidence.
I have the same problem but in my case, i can use the undo function in the assistant editor view.
try it
I hope this help!

Xcode 5 dp crashes when typing any code

Initially I thought it was Apple's fault. My Xcode 5 dp crashes every time when I tried to type any code.
Launch Terminal
cd ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/
cd ~/Library/Developer/Xcode/Third-Party\ Plug-ins/
Rename/Delete your Plug-ins one by one until XCode 5 works.
In Xcode 5 go to Preferences > Source Control > Uncheck the Enable Source control
This problem has something to do with auto completion. I remembered I installed a plugin KSImageNamed. It will auto complete your image name when typing -[UIImage imageNamed:]. And most importantly, I saw its name in crash report.
Solution: Go to ~/Library/Application Support/Developer/Shared/Xcode and delete KSImageNamed.xcplugin.
Great Post. For my case, it is another type of xcode plugin name called "lin" which will do the similar thing. After the plugin is moved to trash, works fine.
Additionally you should also remove any plug-ins that are located at ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/
If all fails, you might have to uninstall Xcode
I had same problem. If you go to XCode -> Preferences -> Source Control and turn OFF Source Control everything works like a charm and there are no more crashes!!! :) Hope this help ;)
In my case the problem was in user defined code snippets, located at ~/Library/Developer/Xcode/UserData/CodeSnippets. Two different snippets had same Completion Shortcut.

How in the earth my aplication is still running even when the appdelegate and main.m is missing

I restore the apps from time machine.
The app run just fine.
However, when I check the project, my appDelegate is gone. I can't see the file in the editor. It becomes red.
What is going on?
The files are still in finder though.
Restarting xcode doesn't work. Removing and adding files is kind of risky, though I'll give it a try tomorrow.
Maybe xcode just "forget" where the file is. But I get my app compiled.
Note: The problem is solved. Restarting iMac works. It's one of those get fixed by it self eventually. However, if someone can explain why the hell this happened in the first place it'll be great.
Check the target's Build Phases. The files being compiled can be shown in Finder using a context menu.
u can do a dirty move trick in deleting and re-adding ur file into Xcode. They'be correctly added into the build phase as well.
Deleting the reference is not risky because the references are lost. If you do a clean project, you may have a compiler build error.
U just has to drop again ur already added file into your Xcode project, but don't check "Copy items into destination group's folder" since your files are already included in your folder.
This happening to me lot of time when i'm using svn.
All those are good answer. I restarted iMac and things work fine.
I think this has happened several times. It's one of those fixed by itself problem eventually. This one it ticked me off that I asked question.
I still do not understand why it actually happens. So I'll wait for more people to answer this.

Is there ANY way to make Xcode monitor folders for files adding / deletions?

I'm using Xcode for a year now, and it's always bothered me if there is any way to tell Xcode to actually "Include the folder" in the project.
What I mean by that, is that I want that when I create or drop new file inside that folder, Xcode will automatically add it to the project.
Of course it should be the same about deleting - I don't want Xcode to complain all the time
OMG I can't see file! I'm gonna cry and make it shiny red.
Rather I want Xcode to just remove the file's reference from the project.
So, Is there any way to do that?
Thanks!
No.
The closest thing you can do is drag your folders into Xcode from Finder. For deletions, delete in Xcode first and select the button for moving your files to the trash.