I'm using Xcode 4.6.1 on OSX Mountain Lion 10.8.3
I have moved my source code from my macbook air to my iMac this morning.
And now, each time I try to modify my source code, XCode crashes!
For example, if I start to write something like this : [ [ anyclass
XCode will crash with this message : Cannot add another user snippet with the same identifier, you can only override system snippets.
But if I writes the code in a text editor before, and then if I pastes it to XCode, it works!
I don't understand ... I have emptied my derived data, cleaned my project, emptied the /var/folders directory, rebooted my iMac ...
Many thanks for your help!
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 4H512
ASSERTION FAILURE in /SourceCache/IDECodeSnippetLibrary/IDECodeSnippetLibrary-2055/Source/IDECodeSnippetRepository.m:320
Details: Cannot add another user snippet with the same identifier, you can only override system snippets.
Object: <IDECodeSnippetRepository: 0x4050a98c0>
Method: -addCodeSnippet:
Thread: <NSThread: 0x40030a220>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x000000010b681a2a -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1 0x000000010a9255f4 _DVTAssertionFailureHandler (in DVTFoundation)
2 0x000000010f40f975 -[IDECodeSnippetRepository addCodeSnippet:] (in IDECodeSnippetLibrary)
3 0x000000010f40fcfb -[IDECodeSnippetRepository _loadUserCodeSnippets] (in IDECodeSnippetLibrary)
4 0x000000010f40ee63 -[IDECodeSnippetRepository init] (in IDECodeSnippetLibrary)
5 0x000000010f4150c4 __44+[IDECodeSnippetRepository sharedRepository]_block_invoke (in IDECodeSnippetLibrary)
6 0x00007fff94b950b6 _dispatch_client_callout (in libdispatch.dylib)
7 0x00007fff94b95041 dispatch_once_f (in libdispatch.dylib)
8 0x000000010f40ecaa +[IDECodeSnippetRepository sharedRepository] (in IDECodeSnippetLibrary)
9 0x000000010f416cbe __102+[IDECodeSnippetLibraryCompletionStrategy _generateCompletionsForScopes:language:platformNames:atBOL:]_block_invoke (in IDECodeSnippetLibrary)
Giving full credit to Matthias, the problem appears to be tightly related to using a cloud source for your code snippets. I did this a long time ago and love the seamless availability of my custom code snippets on all my Macs (iMac 27" at work, rMBPro and MBAir). This kind of cloud storage of code snippets also makes for quick setting up of a new Mac. Yesterday, I dug out an old MBAir that I was using for development a year or so ago, when I synced Dropbox, there must have been some conflicts with my snippets that I changed since I last used said MBAir. Dropbox appends to the name a short piece of text indicating it is a conflicting copy. Unfortunately, Xcode doesn't see this as a different file and thinks it is a duplicate (which ain't allowed).
To solve, I just deleted the conflicting copies (all of them were the old versions), fired up Xcode and no problems.
If anyone is interested about doing this kind of Dropbox syncing of snippets:
http://irockios.com/xcode-code-snippets-everywhere/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With