Xcodebuild throws assert failures after successful build? - xcodebuild

I'me getting the following after building from he command line using xcodebuild, ay ideas what might be wrong?
** BUILD SUCCEEDED **
2010-06-06 20:20:12.916 xcodebuild[8267:80b] [MT] ASSERTION FAILURE in
/SourceCache/DevToolsBase/DevToolsBase-1648/pbxcore/Target.subproj/PBXTarget.m:597
Details: Assertion failed: (nil == _buildContext) || (nil == [_buildContext target])
Object: <PBXLegacyTarget:0x104b97370>
Method: -dealloc
Thread: <NSThread: 0x100b141a0>{name = (null), num = 1}
Backtrace:
0 0x000000010035feaf -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore)
1 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore)
2 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore)
3 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore)
4 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore)
5 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation)
6 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation)
7 0x00007fff822396b3 _CFRelease (in CoreFoundation)
8 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore)
9 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation)
10 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation)
11 0x000000010000c60d
12 0x00000001000014f4
** INTERNAL ERROR: Uncaught Exception **
Exception: ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-1648/pbxcore/Target.subproj/PBXTarget.m:597
Details: Assertion failed: (nil == _buildContext) || (nil == [_buildContext target])
Object: <PBXLegacyTarget:0x104b97370>
Method: -dealloc
Thread: <NSThread: 0x100b141a0>{name = (null), num = 1}
Backtrace:
0 0x000000010035feaf -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore)
1 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore)
2 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore)
3 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore)
4 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore)
5 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation)
6 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation)
7 0x00007fff822396b3 _CFRelease (in CoreFoundation)
8 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore)
9 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation)
10 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation)
11 0x000000010000c60d
12 0x00000001000014f4
Stack:
0 0x00007fff822ded06 __exceptionPreprocess (in CoreFoundation)
1 0x00007fff832470f3 objc_exception_throw (in libobjc.A.dylib)
2 0x00007fff823369b9 -[NSException raise] (in CoreFoundation)
3 0x000000010035ff6a -[XCAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore)
4 0x000000010035fc1a _XCAssertionFailureHandler (in DevToolsCore)
5 0x00000001002790d1 -[PBXTarget dealloc] (in DevToolsCore)
6 0x00000001002911e8 -[PBXLegacyTarget dealloc] (in DevToolsCore)
7 0x00000001002c5b16 -[PBXTargetBookmark dealloc] (in DevToolsCore)
8 0x00007fff8224ff71 __CFBasicHashStandardCallback (in CoreFoundation)
9 0x00007fff82250931 __CFBasicHashDrain (in CoreFoundation)
10 0x00007fff822396b3 _CFRelease (in CoreFoundation)
11 0x0000000100254171 -[PBXProject dealloc] (in DevToolsCore)
12 0x00007fff82262d56 _CFAutoreleasePoolPop (in CoreFoundation)
13 0x00007fff841b530c -[NSAutoreleasePool drain] (in Foundation)
14 0x000000010000c60d
15 0x00000001000014f4
Abort trap

I have the exact same symptoms... and no clue. It use to work fine with my projects. I drastically changed my build settings and now it does this???
Even if build settings are wrong XCode should not crash.
For me it still generate the valid binaries at the end. Sounds like XCode crashing when closing the project and deallocating something.
However it seems that I have found a way of getting rid of the errors by deleting all the .pbxuser and the .perspectivev3 file inside the xcode project package.
If you are like me and you have a ton of Xcode projects you might want to run the following command at the root of your code base:
find . -type f -name "*.pbxuser" -exec rm -f {} \;
find . -type f -name "*.perspectivev3" -exec rm -f {} \;

I also had this fix my problem where I was unable to open an XCode project when starting the XCode application. I had installed an older version of XCode as well as an older version of the iOS SDK.

Please be careful with Steph solution as it can cause havoc. This is a similar question and answer: xcode Assertion failed
If people are generally looking for a Assert failure trouble shooting.

Related

Xcode 8.3.1 crashing at launch after adding unit tests

Suddenly Xcode has begun to crash at launch when I simply added a few unit tests. It works and runs fine in App Code. I've cleared derived data as well as the xcuserdata directories within the project. Any other ideas?
Process: Xcode [26423]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 8.3.1 (12170)
Build Info: IDEFrameworks-12170000000000000~7
App Item ID: 497799835
App External ID: 821611362
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [26423]
User ID: 501
Date/Time: 2017-04-12 00:40:23.567 +0400
OS Version: Mac OS X 10.12.4 (16E195)
Report Version: 12
Anonymous UUID: A61178D2-CCD8-EB05-35BC-2919E1453F0A
Sleep/Wake UUID: 0957325A-2586-4141-9E55-27CBC55A7323
Time Awake Since Boot: 60000 seconds
Time Since Wake: 3000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
MainQueue: -[Xcode3TargetEntitlementsCoordinator syncPerformEntitlementsInteractionBlock:]_block_invoke
ProductBuildVersion: 8E1000a
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[__NSCFString allKeys]: unrecognized selector sent to instance 0x7ff3db72d8c0
UserInfo: (null)
Hints:
Backtrace:
0 __exceptionPreprocess (in CoreFoundation)
1 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
2 objc_exception_throw (in libobjc.A.dylib)
3 -[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
4 ___forwarding___ (in CoreFoundation)
5 _CF_forwarding_prep_0 (in CoreFoundation)
6 -[Xcode3TargetEntitlementsCoordinatorToken allEntitlementKeys] (in DevToolsCore)
7 __94-[Xcode3TargetCapabilitiesContext _appIDFeatureStateIncludingEntitlements:buildConfiguration:]_block_invoke (in DevToolsCore)
8 DVTSyncPerformBlock (in DVTFoundation)
9 -[Xcode3TargetEntitlementsCoordinator syncPerformEntitlementsInteractionBlock:] (in DevToolsCore)
10 -[Xcode3TargetCapabilitiesContext _appIDFeatureStateIncludingEntitlements:buildConfiguration:] (in DevToolsCore)
11 -[Xcode3Target appIDFeaturesForConfigurationNamed:] (in DevToolsCore)
12 +[IDEProvisionableSnapshot snapshotFromProvisionable:overrides:] (in IDEFoundation)
13 __72-[IDEProvisionableManager _evaluateStatusWithStatusEvaluator:overrides:]_block_invoke_2 (in IDEFoundation)
14 -[_DVTTimeSlicedMainThreadOrderedNonUniquingWorkQueue _processWorkItemsWithDeadline:] (in DVTFoundation)
15 -[DVTTimeSlicedMainThreadWorkQueue _processWithDeadline:] (in DVTFoundation)
16 -[_DVTTimeSlicedMainThreadActiveWorkQueues _processWorkQueuesOnDeadline] (in DVTFoundation)
17 __NSFireDelayedPerform (in Foundation)
18 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation)
19 __CFRunLoopDoTimer (in CoreFoundation)
20 __CFRunLoopDoTimers (in CoreFoundation)
21 __CFRunLoopRun (in CoreFoundation)
22 CFRunLoopRunSpecific (in CoreFoundation)
23 RunCurrentEventLoopInMode (in HIToolbox)
24 ReceiveNextEventCommon (in HIToolbox)
25 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
26 _DPSNextEvent (in AppKit)
27 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
28 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
29 -[NSApplication run] (in AppKit)
30 NSApplicationMain (in AppKit)
31 start (in libdyld.dylib)
It was the entitlements file. Accidentally it had some invalid entries and somehow that seems to have been the cause of the crash. Will file a radar.

Xcode 7.3 archiving ends but crashes Xcode with error : bundleIdentifier should be a non-empty string, but it's an empty string

An enterprise app written in swift and having dependencies on libraries and frameworks(swift or objc) archives successfully and gives ipa successfully when archived using Xcode 7.2.1 but on Xcode 7.3 the archiving succeeds but crashes without giving an ipa with following error message,
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
ProductBuildVersion: 7D175
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-10183.3/IDEProducts/DVTProducts/DVTProducts/DVTProducts/DVTProductVersion.m:44
Details: bundleIdentifier should be a non-empty string, but it's an empty string
Object: <DVTProductVersion: 0x7ff47b18ac40>
Method: -initWithBundleIdentifier:version:buildNumber:name:childProducts:productCategory:
Thread: <NSThread: 0x7ff471c18210>{number = 1, name = main}
Hints: None
Backtrace:
0 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 -[DVTProductVersion initWithBundleIdentifier:version:buildNumber:name:childProducts:productCategory:] (in DVTProducts)
4 +[DVTProductVersion productVersionFromArchive:withError:] (in DVTProducts)
5 -[DVTArchiveProductSource _productsFromArchives:coordinator:] (in DVTProducts)
6 __58-[DVTArchiveProductSource updateArchivesDelayedInvocation]_block_invoke (in DVTProducts)
7 -[DVTDelayedInvocation runBlock:] (in DVTFoundation)
8 -[DVTDelayedInvocation invokeIfNeeded] (in DVTFoundation)
9 -[DVTArchiveProductSource refreshProducts] (in DVTProducts)
10 +[IDEArchivesViewController revealArchive:] (in IDEProductsUI)
11 +[IDEArchivesViewController revealArchiveNotification:] (in IDEProductsUI)
12 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (in CoreFoundation)
13 ___CFXRegistrationPost_block_invoke (in CoreFoundation)
14 _CFXRegistrationPost (in CoreFoundation)
15 ___CFXNotificationPost_block_invoke (in CoreFoundation)
16 -[_CFXNotificationRegistrar find:object:observer:enumerator:] (in CoreFoundation)
17 _CFXNotificationPost (in CoreFoundation)
18 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation)
19 -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] (in DVTFoundation)
20 __42-[IDEArchiveManager _revealArchiveAtPath:]_block_invoke (in IDEFoundation)
21 ___DVTAsyncPerformBlockOnMainRunLoop_block_invoke (in DVTFoundation)
22 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ (in CoreFoundation)
23 __CFRunLoopDoBlocks (in CoreFoundation)
24 __CFRunLoopRun (in CoreFoundation)
25 CFRunLoopRunSpecific (in CoreFoundation)
26 RunCurrentEventLoopInMode (in HIToolbox)
27 ReceiveNextEventCommon (in HIToolbox)
28 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
29 _DPSNextEvent (in AppKit)
30 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
31 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
32 -[NSApplication run] (in AppKit)
33 NSApplicationMain (in AppKit)
34 0x000000010028b39b (in Xcode)
35 start (in libdyld.dylib)
abort() called
Any help is appreciated :)
A workaround was given to this bug by apple(as copy pasted below), and was fixed in Xcode 7.3.1
Hi rgh,
This is a courtesy email regarding Bug ID# 25849118.
Engineering has provided the following feedback regarding this issue:
You can workaround this issue by following these steps:
Close Xcode.
Move ~/Library/Developer/Xcode/Products to a different location.
Reopen Xcode. Attempt rearchiving.
You should then be able to put back your product directory. If the
crash still occurs, please let us know.
THE INFORMATION CONTAINED IN THIS MESSAGE IS UNDER NON-DISCLOSURE
Bug ID #: 25849118 Bug Title: Xcode 7.3 succeeds archiving but crashes
before creation of ipa
Summary: Currently archiving with Xcode
7.2.1 without any issues. As the log suggests i have gone through all libraries, bundles and frameworks which are included as dependencies
if any of has missed setting bundle identifier. After confirming
nothing is missing it still crashes with the same issue.
Steps to Reproduce:
1. Start archiving.
2. After build succeeds and just before creation of ipa, crash.
Expected Results: IPA
Actual Results: Crash
Version: Xcode 7.3 OSX El Capitan 10.11.4 (15E65)
Notes: Tried deleting all derived data. Did try after setting missing
bundle identifier for all included dependencies(frameworks, bundles,
libraries).
Configuration: xcode 7.2.1 on the same machine succeeds.
Attachments: 'Xcode_2016-04-19-140323_Raghavendras-MacBook-Pro.crash'
was successfully uploaded.

QuartzCore - Crash in iOS8

After releasing the new version of my iOS application , I am getting the following crash frequently.
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x80000012
This is one of the irritating crashes where stack trace didn't give any clues related to where its crashing or what causes the crash. One major thing is that this crash is only there in iOS8. Please find below the stack trace :
0 libobjc.A.dylib objc_msgSend + 5 release
1 CoreFoundation CFRelease + 600
2 QuartzCore CA::release_objects(X::List<void const*>*) + 16
3 QuartzCore -[CAAnimation dealloc] + 54
4 libobjc.A.dylib objc_object::sidetable_release(bool) + 166
5 libobjc.A.dylib (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 404
6 CoreFoundation _CFAutoreleasePoolPop + 16
7 Foundation -[NSAutoreleasePool drain] + 122
8 CFNetwork AutoAutoreleasePool::~AutoAutoreleasePool() + 24
9 CFNetwork ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 166
10 CFNetwork RunloopBlockContext::_invoke_block(void const*, void*) + 60
11 CoreFoundation CFArrayApplyFunction + 36
12 CFNetwork RunloopBlockContext::perform() + 182
13 CFNetwork MultiplexerSource::perform() + 216
14 CFNetwork MultiplexerSource::_perform(void*) + 48
Any hint would be greatly appreciated. Thanks in advance.
Most of the time, EXC_BAD_ACCESS results from sending a message to an object that has already been released. While this is harder-than-before to do under ARC, it is still possible.
The KERN_INVALID_ADDRESS part just tells you that the memory you tried to access isn't part of your app's memory space, which lends credence to the released-object-handle hypothesis.
To debug previously released objects (called "Zombie" objects), turn on NSZombies in the debugger. In XCode 7...
CMD-SHIFT- to bring up manage schemes.
Select your scheme
Select Diagnostics
Check Enable Zombie Objects
NOTE: you only want to do this on debug builds, as zombie-objects take-up a ton of memory and hurt performance overall. Still, it's an excellent debugging tool.

ARC converted app crashing with last call to .cxx_destruct

Below is the stack trace of the thread of my app which got crashed.
I have recently converted my app to ARC.
The last call is to the cxx_destruct of HomePageViewController which is rootviewcontroller of one of my tab in tabviewcontroller.
The appdelegate implemenation file is not ARC enabled for compilation so the HomePageViewController is released once its added to the tabbarviewcontroller in appdelegate file.
HomePageViewController implementation file is having ARC enabled flag for compilation.
Can someone guide me in correct direction.
0 libobjc.A.dylib 0x35bcdf2a objc_release
1 MySample 0x00096142 -[HomePageViewController .cxx_destruct] + 402
2 libobjc.A.dylib 0x35bcff3a object_cxxDestructFromClass(objc_object*, objc_class*)
3 libobjc.A.dylib 0x35bcd0ce objc_destructInstance
4 libobjc.A.dylib 0x35bcd3a2 object_dispose
5 UIKit 0x37b05c84 -[UIViewController dealloc]
6 MySample 0x00095afa -[HomePageViewController dealloc] + 218
7 libobjc.A.dylib 0x35bcd484
8 CoreFoundation 0x3801343c _CFAutoreleasePoolPop
9 UIKit 0x37a46d94 _wrapRunLoopWithAutoreleasePoolHandler
10 CoreFoundation 0x380a56ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
11 CoreFoundation 0x380a39bc __CFRunLoopDoObservers
12 CoreFoundation 0x380a3d12 __CFRunLoopRun
13 CoreFoundation 0x38016eb8 CFRunLoopRunSpecific
14 CoreFoundation 0x38016d44 CFRunLoopRunInMode
15 GraphicsServices 0x35ccc2e6 GSEventRunModal
16 UIKit 0x37a8e2fc UIApplicationMain
17 MySample 0x0002be98 main + 116
18 MySample 0x0000315c start +
Comment above is correct; you appear to be manually calling release on that view controller, which is disallowed with ARC. Just remove that call and you ought to be good-to-go.
Also, why did you exclude you app delegate from ARC? There shouldn't even be much code in that class, aside from the Core Data stack if you are using Core Data...

App crashes when launching after updating app via HockeyApp

Here's the CrashReporter information:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x347c2848 __kill + 8
1 [My Application] 0x0002ec44 fatal_signal_handler (PLCrashSignalHandler.m:98)
2 libsystem_c.dylib 0x37518522 _sigtramp + 42
3 [My Application] 0x0003040a uncaught_exception_handler (PLCrashReporter.m:136)
4 CoreFoundation 0x37663984 __handleUncaughtException + 68
5 libobjc.A.dylib 0x334082ca _objc_terminate + 122
6 libc++abi.dylib 0x37f473be safe_handler_caller(void (*)()) + 70
7 libc++abi.dylib 0x37f4744a std::terminate() + 14
8 libc++abi.dylib 0x37f4881e __cxa_rethrow + 82
9 libobjc.A.dylib 0x3340822e objc_exception_rethrow + 6
10 CoreFoundation 0x375b9556 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x375b93b6 CFRunLoopRunInMode + 98
12 UIKit 0x3354dda4 -[UIApplication _run] + 544
13 UIKit 0x3354b05a UIApplicationMain + 1074
14 [My Application] 0x00002a9a main (main.m:54)
15 [My Application] 0x00002a58 0x1000 + 6744
If I delete the app and then download the updated version from scratch it works fine...
This is caused by an Objective-C exception being thrown, caught by the runloop, and re-thrown, resulting in the backtrace being lost.
To debug this without changes in PLCrashReporter/HockeyApp, you could register your own exception handler via NSSetUncaughtExceptionHandler(), and log the provided stack trace via (see [-NSException callStackReturnAddresses]). You'll need to symbolicate the results manually.
As a more general solution for this class of bug, you may be able to get the original exception backtrace by using PLCrashReporter trunk, which will record the exceptions' original backtrace separately in the crash report.
However, the HockeyApp client would need to be minimally modified to support recording the extra stack trace. The text formatter included with PLCrashReporter can be used as an example -- it will format this additional stack trace as an additional named pseudo-thread.