问题
Since I updated Xcode to 6.0.1 and iOS SDK to 8.0 my app no longer work on the device (running iOS 8 ofc). But it works perfectly in the simulator.
The app crashes in UIApplicationMain before any call to the delegate has ever happened. It seems either a value or key is null at CFTypeCollectionRetain.
I've tried
- Recreating certificates/provision profiles.
- Re-built with/without ARC.
- Tested both armv7 and arm64 builds.
- Xcode template (Game) application compiles and runs without probs.
Things to note
- Almost all code is C++, it's a game engine and are using bare minimum of OS services.
- Some global constructors (executed prior to main) are using pthreads primitives.
- No root view controller is created (legacy reasons), instead a custom view is created which uses CAEAGLLayer to "enable" GLES... but since the program doesn't reach the point where those are created I've ignored it for time being.
- Inside UIApplicationMain there is a call to [_UIFlippingView layerClass] which crashes; but cannot find any information about the UIFlippingView class whatsoever on Google...
I don't expect an answer but any good advise as to where look next would be very appreciated!
Callstack is as follows:
* thread #1: tid = 0x185d9, 0x23f7646c CoreFoundation`__CFTypeCollectionRetain + 104, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe) * frame #0: 0x23f7646c CoreFoundation`__CFTypeCollectionRetain + 104 frame #1: 0x23fd9168 CoreFoundation`__CFBasicHashAddValue + 564 frame #2: 0x23ec06c0 CoreFoundation`CFBasicHashAddValue + 19048 frame #3: 0x23ef745e CoreFoundation`CFDictionaryCreate + 178 frame #4: 0x28a8d246 BackBoardServices`BKSHIDEventCreateClientAttributes + 186 frame #5: 0x28a8d2ac BackBoardServices`___getHIDEventSystemClient_block_invoke + 36 frame #6: 0x01fab740 libdispatch.dylib`dispatch_once_f + 100 frame #7: 0x28a8d318 BackBoardServices`BKSHIDEventRegisterEventCallback + 84 frame #8: 0x274ab4a8 UIKit`UIApplicationMain + 576 frame #9: 0x0008833c Traktor.Amalgam.App`main(argc=1, argv=0x01d3f9e8) + 196 at Main.mm:15
CoreFoundation`__CFTypeCollectionRetain: 0x23f76404: push {r4, r5, r7, lr} 0x23f76406: mov r4, r1 0x23f76408: add r7, sp, #0x8 0x23f7640a: cbz r4, 0x23f7646c ; __CFTypeCollectionRetain + 104 0x23f7640c: ldrd r0, r1, [r4] 0x23f76410: cmp r0, #0x0 0x23f76412: ubfx r1, r1, #0x8, #0xa 0x23f76416: beq 0x23f7644a ; __CFTypeCollectionRetain + 70 0x23f76418: movw r2, #0xdf70 0x23f7641c: movt r2, #0xe02 0x23f76420: add r2, pc 0x23f76422: ldr r2, [r2] 0x23f76424: cmp r0, r2 0x23f76426: beq 0x23f7644a ; __CFTypeCollectionRetain + 70 0x23f76428: movw r2, #0x4aa4 0x23f7642c: movt r2, #0xe03 0x23f76430: add r2, pc 0x23f76432: ldr.w r5, [r2, r1, lsl #2] 0x23f76436: cmp r0, r5 0x23f76438: beq 0x23f7644a ; __CFTypeCollectionRetain + 70 0x23f7643a: tst.w r0, #0x1 0x23f7643e: beq 0x23f76456 ; __CFTypeCollectionRetain + 82 0x23f76440: mov r0, r4 0x23f76442: blx 0x2400d1e0 ; symbol stub for: +[NSMutableOrderedSet orderedSetWithCapacity:] 0x23f76446: cmp r0, r5 0x23f76448: bne 0x23f76456 ; __CFTypeCollectionRetain + 82 0x23f7644a: mov r0, r4 0x23f7644c: movs r1, #0x0 0x23f7644e: pop.w {r4, r5, r7, lr} 0x23f76452: b.w 0x23eafc38 ; _CFRetain 0x23f76456: movw r0, #0xb93e 0x23f7645a: movt r0, #0xe02 0x23f7645e: add r0, pc 0x23f76460: ldr r1, [r0] 0x23f76462: mov r0, r4 0x23f76464: pop.w {r4, r5, r7, lr} 0x23f76468: b.w 0x2400c0c8 ; objc_msgSend$shim 0x23f7646c: trap -- TRAPPED HERE 0x23f7646e: nop
Inside UIApplicationMain code, interesting is the call to [_UIFlippingView layerClass] which crashes...
0x274ab486: blx 0x27b5b248 ; symbol stub for: roundf$shim 0x274ab48a: movs r5, #0x0 0x274ab48c: movw r0, #0x60f1 0x274ab490: movt r0, #0x0 0x274ab494: add r0, pc 0x274ab496: blx 0x27b595d8 ; symbol stub for: -[UIGravityBehavior _commonInit] 0x274ab49a: movw r0, #0xfa8f 0x274ab49e: movt r0, #0xfff9 0x274ab4a2: add r0, pc 0x274ab4a4: blx 0x27b59068 -- THIS CALL ; symbol stub for: +[_UIFlippingView layerClass] 0x274ab4a8: mov r0, r5 0x274ab4aa: mov r1, r11 0x274ab4ac: blx 0x27b5b248 ; symbol stub for: roundf$shim 0x274ab4b0: movw r1, #0x23e4 0x274ab4b4: movt r1, #0xb12 0x274ab4b8: add r1, pc 0x274ab4ba: ldr r1, [r1] 0x274ab4bc: blx 0x27b5b248 ; symbol stub for: roundf$shim
回答1:
Was able to fix the issue!!
Apparently Xcode had the bad idea of autogenerating a "Product Module Name" setting which didn't match "Product Name" and thus crashed the app when running on the device. This is mindbogglingly bad but imho what to expect of Xcode...
来源:https://stackoverflow.com/questions/25960255/ios-8-uiapplicationmain-crash-since-sdk-8-update