Xcode 5 Couldn't build module Cocoa after inst

2019-03-04 12:15发布

问题:

I just installed Xcode 6 beta 2. After trying it out, I wanted to continue my work and build a project (created with 5.1 and never opened in Xcode 6), in Xcode 5.1 but I get the following error:

Could not build module 'Cocoa'

The prefix file the error is coming from looks like this (I didn't modified it):

#ifdef __OBJC__
    #import <Cocoa/Cocoa.h>
#endif

Every time I try to build this message is logged:

xpcd[235]: Info.plist does not contain an XPCService dictionary: /System/Library/Frameworks/Security.framework/XPCServices/SecurityAgent.xpc

I'm not sure the above message has anything to do with the problem.

Additionally now it seems to me like I can't build any project using Xcode 5.

回答1:

If you opened that project in Xcode 6, it's busted now. You need to revert it to before that. Hope you have SCM in place, or at least TimeMachine.

Otherwise, check what xcode-select -p says. You may have to re-select Xcode 5. Alternatively, open Xcode Preferences and select the last tab “Locations”. There is a pop-up menu for Command Line Tools. It may still point to Xcode 6.



回答2:

I finally restored Xcode 5 using Time Machine to a version before my install of Xcode 6 Beta 2. It works again, but I have no idea what Xcode 6 Beta 2 did to break it.