Search code examples
objective-cxcodexcodebuild

Xcode crashes - but only for a specific project (target 'MyApp' has been asked for its build context but it does not belong to a project)


Whenever I try to run a specific project / app from Xcode it crashes with the details in the backtrace (please see below).

All sorts of funny stuff is going on running this in Xcode.

First, deleting the app from the iPad simulator and then running it for the first time seems to be working 90% of the time. But then either the second or the third attempt running on the iPad simulator it crashes again.

Trying to run it on a iPad device always crash, not luck at all.

Another funny thing I noticed is that whenever I do manage to get it to run for a second time on the iPad simulator all my appearance code (colors etc.) define in my app delegate is gone...

The only clue I could gather from the backtrace is: target 'MyApp' has been asked for its build context but it does not belong to a project

So, I'm not sure wheter this is Xcode related or perhaps somthing with the workspace / project file since it only crashes on this very specific project. If it is a problem with my workspace or project file, does anybody know how to fix this?

I appreciate your help.

Backtrace details:

Application Specific Information:
ProductBuildVersion: 4E2002
ASSERTION FAILURE in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-    1197/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/Target.subproj/PBXTarget.m:4006
Details:  target 'MyApp' has been asked for its build context but it does not     belong to a project
Object:   <PBXNativeTarget: 0x409f3d8c0>
Method:   -targetBuildContext
Thread:   <NSThread: 0x40a7d8a80>{name = (null), num = 51}
Hints:   None
Backtrace:
0  0x000000010bbbbb9f -[IDEAssertionHandler  handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1  0x000000010b070635 _DVTAssertionFailureHandler (in DVTFoundation)
2  0x000000010e18c505 -[PBXTarget targetBuildContext] (in DevToolsCore)
3  0x000000010e18fec4 -[PBXTarget(XCBuildables) buildDidFinishWithBuildLogRecorder:] (in   DevToolsCore)
4  0x000000010e2fefe2 -[Xcode3TargetBuildableSnapshot buildForBuilderDidFinish:] (in   DevToolsCore)
5  0x000000010b6bb668 -[IDEBuildableSnapshot performBuildForBuilder:buildCommand:buildOnlyTheseFiles:] (in IDEFoundation)
6  0x000000010b6bada6 -[IDEBuilder main] (in IDEFoundation)
7  0x00007fff95e8b6b4 -[__NSOperationInternal start] (in Foundation)
8  0x00007fff95e9e912 ____NSOQSchedule_block_invoke_2 (in Foundation)
9  0x00007fff96d6da86 _dispatch_call_block_and_release (in libdispatch.dylib)
10  0x00007fff96d6e965 _dispatch_worker_thread2 (in libdispatch.dylib)
11  0x00007fff8f67c3da _pthread_wqthread (in libsystem_c.dylib)
12  0x00007fff8f67db85 start_wqthread (in libsystem_c.dylib)

objc[31243]: garbage collection is ON
abort() called

Solution

  • So I finally figured out what the problem was.

    I was using a build script that bumped my build number (CFBundleShortVersionString) after each build.

    It seems Xcode doesn't like the fact that the plist file gets changed underneath it.

    The only "workaround" I could come up with was to remove the build step containing my version bump script that changed that plist file on every build.