Xcode 5 dp crashes when typing any code - crash

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.

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.

"Show Obj-c Only" flag hides all the content of call tree on xCode Instruments

I'm following this tutorial about Instruments. The tutorial provides a sample project to test the steps described on it.
The problem is that, when I check "Show Obj-c Only" and "Hide System Libraries" flags, all the lines in call tree list is hidden, but the code in the project is written in Obj-C. Is there something I have to change in the configuration to see the project lines as in the tutorial?
Call tree list image taken from the tutorial showing how it must to be:
Screenshot of my instruments execution:
Ok, I don`t really know what happens here, but now it works. How?
What I did:
Erase the app in the device
Kill xCode ( using activity monitor )
Restart the computer ( Only restarting xcode didn't work )
Restart the device.
Clean the project
Try again.
May be is not the best answer, but it worked for me.
[UPDATE] The issue is there again, so I try this: Xcode 4 Instruments doesn't show source lines
And it works!

Storyboard will not save in Xcode

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.

Code loses syntax color in Xcode 4

I have just upgraded to the new Xcode 4 and the code is not colored has it ought to be.
For instance, the string NSString is not colored in my custom code, but when I switch to Apple's code (NSString.h for example) everything is well colored.
How can I fix that?
It's a known bug with the latest XCode. This happens with some projects which are migrated from XCode 3.X to the new version. For some people it seems to help to go to the organizer, and in the project tab delete the derived data for the project where code sense does not work correctly.
If you have a small project, it might also help to create a new project in XCode 4 and import the files from the XCode 3 project.
Update: XCode 4.0.1 made the situation a bit better, at least in some of my projects I have syntax coloring and code sense back. But it's still far from fixed.
Update 2: XCode 4.0.2 did not change much. It seems that the problem is related to subprojects, specifically static libraries. According to comments of this blog post some people were successful by changing header search paths from relative to absolute paths, e.g. instead of Foo/Bar use $(SOURCE_ROOT)/Foo/Bar. This together with switching all projects to XCode 3.1 format and to use LLVM 2.0 fixed a lot for me as well. It's not perfect yet, but usable.
Update 3: After converting the sub projects to independent projects and putting them in a workspace (aka the XCode 4 way) I have now full syntax highlighting and code completion back.
My current environment is now a XCode 4 workspace with each projects being 3.1 compatible (as opposed to the default which is 3.2), LLVM GCC 4.2 (system default) and the header search paths are still absolute (using $(SOURCE_ROOT)/.../).
I used undefined Macro, But those macros defined in Preprocessor Macros in build settings. So the xcode4 didn't generate any error for that undefined macro.
Steps taken to resolve.
Removed undefined macros wherever I used those undefined macros.
Removed duplicate definitions of Marcos.
Removed duplicate Resources. (I'd added same (many Thumbs.db files) files into the project.)
Clean & Build.
if still you are not getting the color then, please relocate your project to some different location, I changed to my Desktop location.
After these steps I got the color in my eyes.
But its very bad issue. I sucks lot of valuable time. I think these steps may help you.
Thanks.
I had the same problem with mine. Its a cocos2d game with box and chipmunk. It was a hell of a mess getting the project to recognize and find the user search paths in the first place so I wasn't about to mess with those.
What I wanted to point out is that I DO HAVE recursive paths and I do have relative paths and I still got the issue. It happened when I added a new version of a 3rd party SDK I was using. It was Testflight 083 which I updagraded to 1.0. I erased my old version but only removed references. Then I manually deleted it from finder. Imported the new SDKv1 folder and readded it to my project and removed the old SDK0 folder path leaving only the newly added SDK1 folder path. For some reason I noticed that even though in v083 I had used a #import in my Prefix.pch file, it still wasn't recognizing a call to a method from AppDelegate. Which means the #import in Prefix.pch for some reason was not working. I had to add #import to my AppDelegate file individually. This gave me duplicate #imports as Jeeva said above. That sounded an alarm in my head.
So the solution was to go and effectively remove the duplicate #import in Prefix.pch therefore only leaving the one in AppDelegate. It reindexed and CodeSense works again. Thanks Jeeva!
This issue was driving me insane, and I had given up hope of fixing it without some ugly hack on XCode's configuration. I passed through this very forum thread a stack overflow of times. Then one day, I happened to accidentally fix it. I'm not sure if you need all these steps, but I've found this a sure-fire way to fix XCode's indexing issues:
Clean your project (Command-shift-K)
Open organizer, close your project.
Under the "Projects" tab in organizer, remove the derived data for the project you want to reset.
Quit XCode
In the terminal, run:
sudo mdutil -a -i on
This seems to reset spotlight indexing (I don't know much about it because I don't use spotlight).
When the command finishes, Spotlight will have to re-index. Look up to see a little dot in the magnifying glass for your spotlight's icon. When the dot leaves, spotlight has re-indexed. You can check the progress by opening spotlight.
Re-open XCode, and wait for it to re-index all your files.
Build the project.
On build success, you should now have appropriate syntax highlighting again. I hope you guys find this little discovery as useful as I did :)
EDIT:
I should probably add that the syntax highlighting sometimes seems to re-break when the debugger hangs the simulator during app launch. I just try to avoid this by being more careful about letting the process hang.
EDIT2: (sorry first contribution)
Works on XCode 4.6 and 4.6.2.

Xcode 4 "waiting for process 'Appname' to launch

I installed Xcode 4 and now cannot run one of my iPhone projects.
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Waiting for process 'AppName' to launch.
On the top status bar I see 'Attaching to AppName'.
The only weird thing about the project is it has a dependency on ZXingWidget for QR code scans.
Weirder that it works on a co-workers computer, but not mine.
Tried removing my build directory, no dice.
I can run other iPhone projects from source in Xcode 4 with no problem.
Has anyone else seen this?
I ran into the same issue. Go to Product -> Edit Scheme and select the Run scheme on the lefthand side. Go to the info tab, and next to launch there will be two options (neither of them selected): 'Automatically' and 'Wait for XXXX.app to Launch'. Select the Automatically one and it should clear up your issue.
I had actually built and used my projects using xcode 4 for a few days with no issues, and then this popped up randomly. Hope the this helps.
A tip I found at the Apple Developer Forums:
Go into your ProjectName.xcodeproj/
directory and delete anything named
with your userid. Re-open the
project in xcode and all that will get
recreated and it should work. At least
it did for me.
Another tip is to manually delete the build directory.
Yet another tip is to navigate to the Organizer (Shift ⇧ Command ⌘ 2 in xcode 4), select Projects, select you application in the left hand side and then the Delete...-button to the right of Derived Data.
And never forget the universally useful tip: restart your computer and try again.
Good luck!
Yes, you need to set it to automatic but doing that alone won't be enough. Like Chris says, you will need to exit your simulator manually and then run.
for me it was already set on automatic and still had this problem.
The problem solved after I changed the build configuration to Distribution in the product -> scheme
Quit Xcode. Find the App_Name.xcodeproj, "Show Package Contents" and remove the folder "xcuserdata".
This will clean the "cache" of breakpoints. Start Xcode, compile and done :)
You may be click the bottom of Product>scheme>edit scheme >Waitting for executable to be launched.And you should click the Automatically choose.