I'm trying to use the test framework SBTUITestTunnel in my XCTest UI automation. I have the Podfile set up as described:
target 'MyApp' do
pod 'SBTUITestTunnel/Server', '3.0.2'
end
target 'MyAppUITests' do
pod 'SBTUITestTunnel/Client', '3.0.2'
end
However when I go to run my UI tests, they crash right after launching:
2018-03-06 17:19:01.140 MyAppUITests-Runner[64387:8057955] Running tests...
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
* frame #0: 0x000000010944ba19 libsystem_trace.dylib`_os_trace_image_was_unloaded + 244
frame #1: 0x000000010485088a dyld_sim`dyld::removeImage(ImageLoader*) + 343
frame #2: 0x000000010485378a dyld_sim`dyld::garbageCollectImages() + 735
frame #3: 0x0000000104857c5c dyld_sim`dlopen + 924
frame #4: 0x00000001091ccd25 libdyld.dylib`dlopen + 59
frame #5: 0x00000001054981c8 CoreFoundation`_CFBundleDlfcnLoadBundle + 152
frame #6: 0x000000010549804f CoreFoundation`_CFBundleLoadExecutableAndReturnError + 335
frame #7: 0x0000000104a363b5 Foundation`-[NSBundle loadAndReturnError:] + 547
frame #8: 0x0000000104937127 XCTest`_XCTestMain + 514
frame #9: 0x000000010548ab5c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #10: 0x000000010546fe54 CoreFoundation`__CFRunLoopDoBlocks + 356
frame #11: 0x000000010546f5ee CoreFoundation`__CFRunLoopRun + 894
frame #12: 0x000000010546f016 CoreFoundation`CFRunLoopRunSpecific + 406
frame #13: 0x0000000107d8ea24 GraphicsServices`GSEventRunModal + 62
frame #14: 0x0000000105908134 UIKit`UIApplicationMain + 159
frame #15: 0x0000000104845838 MyAppUITests-Runner`___lldb_unnamed_symbol8$$MyAppUITests-Runner + 42
frame #16: 0x00000001091cf65d libdyld.dylib`start + 1
Can anyone help me debug this? I can't even set a breakpoint, so I'm at a loss. Keep in mind my code builds and starts executing. I'm guessing something is either wrong with my Podfile or with my Project config. I tried their suggestion for Framework not found but it didn't help:
If you’re using CocoaPods v1.0 and your UI Tests fail to start, you
may need to add $(FRAMEWORK_SEARCH_PATHS) to your Runpath Search Paths
in the Build Settings of the UI Test target!
I have an app using CoreBluetooth. When I select a Bluetooth device to connect, I get the lldb error with the following backtrace:
* thread #1: tid = 0x2818f, 0x000000018207dbd0 libobjc.A.dylib`objc_msgSend + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
frame #0: 0x000000018207dbd0 libobjc.A.dylib`objc_msgSend + 16
frame #1: 0x00000001882e8ee0 CoreBluetooth`__29-[CBXpcConnection handleMsg:]_block_invoke + 60
frame #2: 0x0000000101191bf0 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #3: 0x0000000101191bb0 libdispatch.dylib`_dispatch_client_callout + 16
frame #4: 0x0000000101197658 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 2096
frame #5: 0x00000001829b4bb0 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
frame #6: 0x00000001829b2a18 CoreFoundation`__CFRunLoopRun + 1628
frame #7: 0x00000001828e1680 CoreFoundation`CFRunLoopRunSpecific + 384
frame #8: 0x0000000183df0088 GraphicsServices`GSEventRunModal + 180
frame #9: 0x0000000187758d90 UIKit`UIApplicationMain + 204
* frame #10: 0x0000000100039adc BluetoothLE`main + 136 at AppDelegate.swift:13
frame #11: 0x00000001824828b8 libdyld.dylib`start + 4
The strange thing is I only get this on my iPad mini 4, not on my iPhone 6...
Please can anybody help me resolve this issue?
Thanks in advance
Did you check in the Device Console in Xcode to see if there are any illuminating messages? iOS tends to use daemon processes to handle services like bluetooth, and error messages from them won't go to the regular Xcode debugging console since they aren't hooked up to the stdout of your program. They will go to the Device Console. That is in the Devices window, select your device and there is a little disclosure widget on the LLHS of the window that reveals the device console.
I'm running into some really strange EXC_BAD_ACCESS crashes which are totally reproducible with the last 2 Xcode 7 Beta versions (including the GM from last night):
When running my application, AFNetworking crashes with an EXC_BAD_ACCESS message in AFURLConnectionOperation.m line 154. More precisely, here is the stacktrace:
thread #1: tid = 0x23b173, 0x000000010b89beaf CoreFoundation`___forwarding___ + 767, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x000000010b89beaf CoreFoundation`___forwarding___ + 767
frame #1: 0x000000010b89bb28 CoreFoundation`__forwarding_prep_0___ + 120
* frame #2: 0x0000000105a4507e MyApp`-[AFURLConnectionOperation .cxx_destruct](self=0x00007fc4d873aa20, _cmd=(null)) + 494 at AFURLConnectionOperation.m:154
frame #3: 0x000000010af637bb libobjc.A.dylib`object_cxxDestructFromClass(objc_object*, objc_class*) + 127
frame #4: 0x000000010af6e390 libobjc.A.dylib`objc_destructInstance + 93
frame #5: 0x000000010b94e7c6 CoreFoundation`-[NSObject(NSObject) __dealloc_zombie] + 150
frame #6: 0x00000001087ee9df Foundation`-[NSOperation dealloc] + 89
frame #7: 0x0000000105a3dca2 MyApp`-[AFURLConnectionOperation dealloc](self=0x00007fc4d873aa20, _cmd="dealloc") + 162 at AFURLConnectionOperation.m:216
frame #8: 0x000000010af78afe libobjc.A.dylib`objc_object::sidetable_release(bool) + 232
frame #9: 0x0000000105a31dd1 MyApp`__destroy_helper_block_((null)=0x00007fc4d8b27000) + 65 at AFHTTPRequestOperation.m:0
frame #10: 0x000000010d1226b1 libsystem_blocks.dylib`_Block_release + 128
frame #11: 0x000000010d0a549b libdispatch.dylib`_dispatch_client_callout + 8
frame #12: 0x000000010d08d34b libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1738
frame #13: 0x000000010b8a63e9 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
frame #14: 0x000000010b867939 CoreFoundation`__CFRunLoopRun + 2073
frame #15: 0x000000010b866e98 CoreFoundation`CFRunLoopRunSpecific + 488
frame #16: 0x000000010dd2cad2 GraphicsServices`GSEventRunModal + 161
frame #17: 0x00000001095c9676 UIKit`UIApplicationMain + 171
frame #18: 0x0000000105767d3f MyApp`main(argc=7, argv=0x00007fff5a541620) + 111 at main.m:33
frame #19: 0x000000010d0da92d libdyld.dylib`start + 1
I set enabled Zombie Objects in my scheme and got the following error
*** -[NSMutableURLRequest release]: message sent to deallocated instance 0x7fc4d8acc460
Would any one of you have an idea what is causing the crash? Using Xcode 6 works like a charm but I'd really like to use the new Swift features in my code ...
To answer my own question and leave this here for anyone out there who might be running into the same problem:
Apparently, the Swift 2.0 compiler doesn't like closures being passed an inout parameter. I had a closure in place which could be used to further customize my request which took an object of type NSMutableURLRequest as an inout parameter. Once changing this closure to simply return the request and removing the inout everything works as expected again ...
I have spent over a ton of hours working on an app, it works perfectly on iOS 7, both on device and simulator. When I run it on iOS 8, it works perfectly on simulator. But for some reason, when I run it on my iOS 8 device, it starts crashing weirdly. If I implement CLLocation, the app will run smoothly for the first 5 times that I run it. Then it will crash the MOMENT I compile it for the next 5 times. After that 5 times, it starts compiling smoothly again. Then after 5 more times, it crashes on launch again, and the pattern continues.
IE. 1, run. 2. run. 3. run. 4. run. 5. run. 6-10.crash on launch, 11-15, run. 16-20 crash
HOWEVER, when I remove CLLocation, the app runs smoothly, but crashes on every 3rd launch. IE. 1. run. 2. run. 3. crash. 4. run. 5. run 6. crash.
I have been banging my head against the wall for like days without sleep on this. Can someone please explain to me why? For every crash on launch, the only error the console outputs is NSDictionary unknown selector.
I don't want my app to get rejected if Apple reviewers happen to run it at one of the "crash times"
Console Bt
(lldb) bt
* thread #3: tid = 0x12646, 0x00000001983640a8 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.root.default-qos', stop reason = breakpoint 1.1
frame #0: 0x00000001983640a8 libobjc.A.dylib`objc_exception_throw
frame #1: 0x0000000187d8d094 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 220
frame #2: 0x0000000187d89e48 CoreFoundation`___forwarding___ + 928
frame #3: 0x0000000187c8f08c CoreFoundation`_CF_forwarding_prep_0 + 92
frame #4: 0x0000000188c4f0dc Foundation`-[NSString getExternalRepresentation:extendedAttributes:forWritingToURLOrPath:usingEncoding:error:] + 192
frame #5: 0x0000000188c4f23c Foundation`writeStringToURLOrPath + 72
* frame #6: 0x00000001000c9f1c Blurtalk`+[PFInternalUtils installationId](self=<unavailable>, _cmd=<unavailable>) + 340 at PFInternalUtils.m:307
frame #7: 0x00000001000f0a94 Blurtalk`+[PFNetworkCommandRunner createRequest:](self=0x000000010027d1b8, _cmd=<unavailable>, command=0x0000000170056a70) + 268 at PFNetworkCommandRunner.m:61
frame #8: 0x00000001000f1044 Blurtalk`+[PFNetworkCommandRunner runCommandAsync:inOperation:](self=0x000000010027d1b8, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>) + 196 at PFNetworkCommandRunner.m:132
frame #9: 0x00000001000f1748 Blurtalk`+[PFRetryingCommandRunner runCommandAsync:inOperation:attemptsMade:delay:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>, attemptsMade=1, delay=<unavailable>) + 92 at PFRetryingCommandRunner.m:42
frame #10: 0x00000001000f16bc Blurtalk`+[PFRetryingCommandRunner runCommandAsync:inOperation:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>) + 124 at PFRetryingCommandRunner.m:35
frame #11: 0x00000001000f1f80 Blurtalk`+[PFCachedCommandRunner runCommandAsync:inOperation:cachePolicy:maxCacheAge:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>, cachePolicy=<unavailable>, maxCacheAge=<unavailable>) + 240 at PFCachedCommandRunner.m:82
frame #12: 0x000000010009dcd8 Blurtalk`__48-[BFTask continueWithExecutor:withSuccessBlock:]_block_invoke(.block_descriptor=0x0000000170241e60, task=<unavailable>) + 200 at BFTask.m:335
frame #13: 0x000000010009d730 Blurtalk`__41-[BFTask continueWithExecutor:withBlock:]_block_invoke_2(.block_descriptor=0x000000017807a340) + 32 at BFTask.m:287
frame #14: 0x0000000100338f20 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #15: 0x0000000100338ee0 libdispatch.dylib`_dispatch_client_callout + 16
frame #16: 0x00000001003459a0 libdispatch.dylib`_dispatch_root_queue_drain + 1272
frame #17: 0x0000000100346f18 libdispatch.dylib`_dispatch_worker_thread3 + 132
frame #18: 0x0000000198b852e4 libsystem_pthread.dylib`_pthread_wqthread + 816
I have been able to reproduce and narrow down your crash using NSZombieEnabled.
My backtrace:
2014-12-30 14:58:26.997 Proto[1398:513570] *** -[CFString getExternalRepresentation:extendedAttributes:forWritingToURLOrPath:usingEncoding:error:]: message sent to deallocated instance 0x170e78fc0
(lldb) bt
* thread #7: tid = 0x7d622, 0x00000001864be440 CoreFoundation`___forwarding___ + 968, queue = 'com.apple.root.default-qos', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1864be440)
* frame #0: 0x00000001864be440 CoreFoundation`___forwarding___ + 968
frame #1: 0x00000001863c2b6c CoreFoundation`_CF_forwarding_prep_0 + 92
frame #2: 0x000000018738a83c Foundation`writeStringToURLOrPath + 72
frame #3: 0x00000001002485bc Proto`+[PFInternalUtils installationId](self=<unavailable>, _cmd=<unavailable>) + 340 at PFInternalUtils.m:308
frame #4: 0x000000010028a944 Proto`+[PFNetworkCommandRunner createRequest:](self=0x000000010054eea8, _cmd=<unavailable>, command=0x0000000170446990) + 308 at PFNetworkCommandRunner.m:62
frame #5: 0x000000010028aef4 Proto`+[PFNetworkCommandRunner runCommandAsync:inOperation:](self=0x000000010054eea8, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>) + 196 at PFNetworkCommandRunner.m:133
frame #6: 0x000000010028b5fc Proto`+[PFRetryingCommandRunner runCommandAsync:inOperation:attemptsMade:delay:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>, attemptsMade=1, delay=<unavailable>) + 92 at PFRetryingCommandRunner.m:42
frame #7: 0x000000010028b570 Proto`+[PFRetryingCommandRunner runCommandAsync:inOperation:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>) + 124 at PFRetryingCommandRunner.m:35
frame #8: 0x000000010028be40 Proto`+[PFCachedCommandRunner runCommandAsync:inOperation:cachePolicy:maxCacheAge:](self=<unavailable>, _cmd=<unavailable>, command=<unavailable>, operation=<unavailable>, cachePolicy=<unavailable>, maxCacheAge=<unavailable>) + 248 at PFCachedCommandRunner.m:83
frame #9: 0x00000001001ad038 Proto`__48-[BFTask continueWithExecutor:withSuccessBlock:]_block_invoke(.block_descriptor=0x0000000170446ea0, task=<unavailable>) + 200 at BFTask.m:335
frame #10: 0x00000001001aca90 Proto`__41-[BFTask continueWithExecutor:withBlock:]_block_invoke_2(.block_descriptor=0x0000000171067b40) + 32 at BFTask.m:287
frame #11: 0x0000000100ab8e30 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #12: 0x0000000100ab8df0 libdispatch.dylib`_dispatch_client_callout + 16
frame #13: 0x0000000100ac59a0 libdispatch.dylib`_dispatch_root_queue_drain + 1280
frame #14: 0x0000000100ac6f18 libdispatch.dylib`_dispatch_worker_thread3 + 132
frame #15: 0x00000001974312e4 libsystem_pthread.dylib`_pthread_wqthread + 816
This is a bug in the Parse SDK, specifically when Parse tries to get device information on an initial install. I suggest you report this bug to Parse directly and point them to this StackOverflow question.
Additional conversation here: Parse Objective C library crashes on [PFInternalUtils installationId]
EDIT: There is an open bug report for this issue here: https://developers.facebook.com/bugs/1548203598729083
you should create an one for all breakpoint that will stop on any exception, please read this article, it is a very useful technique.
http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions
by the way, NSDictionary does not have length, it seems like you made a mistake by confusing it with a NSString object.
This problem is iOS Simulator only, it doesn't not happen on Device.
My application doesn't even get into the main function. It crashes somewhere in malloc:
* thread #1: tid = 0x1c03, 0x96fc1548 libsystem_c.dylib`malloc_zone_malloc + 72, stop reason = EXC_BAD_ACCESS (code=2, address=0xc)
frame #0: 0x96fc1548 libsystem_c.dylib`malloc_zone_malloc + 72
frame #1: 0x02f51a38 CoreFoundation`__CFAllocatorSystemAllocate + 24
frame #2: 0x02f51a13 CoreFoundation`CFAllocatorAllocate + 147
frame #3: 0x02f5922c CoreFoundation`__CFGetConverter + 508
frame #4: 0x02fa3dee CoreFoundation`CFStringEncodingGetConverter + 14
frame #5: 0x02f6f4ee CoreFoundation`CFStringGetSystemEncoding + 62
frame #6: 0x01b7b062 Foundation`_NSDefaultCStringEncoding + 19
frame #7: 0x02b547cf libobjc.A.dylib`_class_initialize + 305
frame #8: 0x02b5ba0d libobjc.A.dylib`prepareForMethodLookup + 158
frame #9: 0x02b52aeb libobjc.A.dylib`lookUpMethod + 81
frame #10: 0x02b52e22 libobjc.A.dylib`_class_lookupMethodAndLoadCache3 + 47
For some reason, enabled Guard Malloc makes it work just fine.
My application was working fine with the previous version of Xcode. Something about iOS 6/Xcode 4.5 caused this to arise.