iOS App crashes only when attached to the debugger - ios

i have an issue where my app crashes when attached to the debugger in just one case. My App downloads json data and transform it into core data objects. For this purpose i start a background thread to load it and have a successHandler handling the import:
RemoteConnectionService.sharedInstance.sendRequest(UserRequest(userID: user!.webID.integerValue), successHandler: { requestHandler, result in
var userData = result["user"] as! [String: AnyObject]
self.user?.update(userData)
self.tableView.reloadData()
}, errorHandler: nil)
this works everywhere as expected. the successHandler is called on the main thread, core data gets updated and all. but when doing this special request (it happens always and only with this request) Xcode stop pointing to
class AppDelegate: UIResponder, UIApplicationDelegate
with no specific failure reason. here's the backtrace (via bt):
* thread #1: tid = 0x6ab4b, 0x00000001051b19c0 libobjc.A.dylib`objc_release + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00000001051b19c0 libobjc.A.dylib`objc_release + 16
frame #1: 0x00000001051b28cd libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 591
frame #2: 0x00000001082348d8 CFNetwork`-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 207
frame #3: 0x0000000108234a37 CFNetwork`-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 48
frame #4: 0x00000001081043a7 CFNetwork`___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 107
frame #5: 0x00000001081d1891 CFNetwork`___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 273
frame #6: 0x00000001080ef6e6 CFNetwork`RunloopBlockContext::_invoke_block(void const*, void*) + 72
frame #7: 0x00000001057c13d4 CoreFoundation`CFArrayApplyFunction + 68
frame #8: 0x00000001080ef5a7 CFNetwork`RunloopBlockContext::perform() + 133
frame #9: 0x00000001080ef3e6 CFNetwork`MultiplexerSource::perform() + 256
frame #10: 0x00000001080ef1fc CFNetwork`MultiplexerSource::_perform(void*) + 72
frame #11: 0x00000001057ee4b1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #12: 0x00000001057e437d CoreFoundation`__CFRunLoopDoSources0 + 269
frame #13: 0x00000001057e39b4 CoreFoundation`__CFRunLoopRun + 868
frame #14: 0x00000001057e33e6 CoreFoundation`CFRunLoopRunSpecific + 470
frame #15: 0x000000010abdba3e GraphicsServices`GSEventRunModal + 161
frame #16: 0x00000001063cab60 UIKit`UIApplicationMain + 1282
* frame #17: 0x00000001049556b7 App`main + 135 at AppDelegate.swift:13
frame #18: 0x00000001088fd145 libdyld.dylib`start + 1
What i don't get here is that when trying to profile it in instruments or just running it in the simulator without Xcode it works just fine. On the device it crashes on that particular request no matter what.
device backtrace looks a bit different:
* thread #1: tid = 0x19e6ab, 0x0000000192490174 libobjc.A.dylib`objc_release + 20, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x13723bec8)
frame #0: 0x0000000192490174 libobjc.A.dylib`objc_release + 20
frame #1: 0x0000000192491724 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
frame #2: 0x00000001817d2e08 CFNetwork`-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 216
frame #3: 0x00000001817d2f7c CFNetwork`-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
frame #4: 0x00000001816a78e4 CFNetwork`___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 104
frame #5: 0x0000000181770540 CFNetwork`___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 104
frame #6: 0x0000000181693b54 CFNetwork`RunloopBlockContext::_invoke_block(void const*, void*) + 76
frame #7: 0x0000000181c10aac CoreFoundation`CFArrayApplyFunction + 68
frame #8: 0x0000000181693a00 CFNetwork`RunloopBlockContext::perform() + 136
frame #9: 0x00000001816938b4 CFNetwork`MultiplexerSource::perform() + 312
frame #10: 0x00000001816936e0 CFNetwork`MultiplexerSource::_perform(void*) + 68
frame #11: 0x0000000181ce69ec CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #12: 0x0000000181ce5c90 CoreFoundation`__CFRunLoopDoSources0 + 264
frame #13: 0x0000000181ce3d40 CoreFoundation`__CFRunLoopRun + 712
frame #14: 0x0000000181c110a4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #15: 0x000000018adab5a4 GraphicsServices`GSEventRunModal + 168
frame #16: 0x0000000186542aa4 UIKit`UIApplicationMain + 1488
* frame #17: 0x0000000100069c8c App`main + 164 at AppDelegate.swift:13
frame #18: 0x0000000192ae6a08 libdyld.dylib`start + 4
Any suggestions on how to debug this? Very much appreciated :)

Related

Xcode UI Test Crashes for exists, isHittable, waitForExistence and recording

I have a very simple Xcode UI Test with this function:
func waitForElementToAppear(_ element: XCUIElement) -> Bool {
let predicate = NSPredicate(format: "exists == true")
let exp = expectation(for: predicate, evaluatedWith: element, handler: nil)
let result = XCTWaiter().wait(for: [exp], timeout: 10)
return result == .completed
}
Which has always worked for me before Xcode 9. I am not sure if this is an Xcode 10 issue, but it has recently started without me adding or changing any code.
Here is my test code:
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
}
This test succeeds - always.
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
if tabbar.isHittable {
}
}
This test fails - always. It does not JUST fail, it crashes with Thread 1: EXC_BAD_ACCESS (code=1, address=0x0).
After more than 99.945 seconds it switches from crashed state to failed test state with the message: Timeout waiting for fulfillment of promise for 'remote query'..
This test:
func testTabBarPress() {
let tabbar = self.app.tabBars["my_tabbar"]
print(tabbar)
if waitForElementToAppear(tabbar) {
}
}
Crashes with the same message of EXC_BAD_ACCESS but it does succeed afterwards.
I also did reset the simulators, cleaned the build folder and updated Xcode to 10.2.1 (10E1001)
At the top of my test I define my app:
private var app: XCUIApplication = XCUIApplication() and in setup() I launch it.
Any help appreciated. Thanks!
Edit:
Here is the stack trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000113a833d0 libsystem_platform.dylib`_platform_strcmp + 80
frame #1: 0x00000001322086f1 UIKit`-[UIViewAccessibility _accessibilityRetrieveIvarText] + 364
frame #2: 0x00000001321f5e54 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewIvarsText] + 118
frame #3: 0x00000001321f6b27 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText:] + 2749
frame #4: 0x00000001321f99c1 UIKit`-[UITableViewCellAccessibility accessibilityLabel] + 123
frame #5: 0x000000012ee47739 PreferencesFramework`-[UITableViewCellAccessibility__Preferences__UIKit accessibilityLabel] + 327
frame #6: 0x000000013243f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #7: 0x000000013243f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #8: 0x00000001321d620e UIKit`-[UINavigationBarAccessibility_UIViewAccessibilityAdditions _accessibilityAXAttributedLabel] + 650
frame #9: 0x000000013220b711 UIKit`-[UITableViewCellAccessibilityElement accessibilityLabel] + 48
frame #10: 0x000000013243f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #11: 0x000000013243f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #12: 0x000000013243e9ae UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityProcessedLabelAttribute] + 34
frame #13: 0x0000000132442c32 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 268
frame #14: 0x000000013246cacd UIAccessibility`_accessibilityAttributesForObject + 493
frame #15: 0x000000013246c43a UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1239
frame #16: 0x000000013246dfd9 UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 1139
frame #17: 0x0000000132441f09 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 8537
frame #18: 0x00000001321cb100 UIKit`-[UIApplicationAccessibility accessibilityAttributeValue:forParameter:] + 290
frame #19: 0x0000000132424657 UIAccessibility`_copyParameterizedAttributeValueCallback + 434
frame #20: 0x0000000130ef1629 AXRuntime`___AXXMIGCopyParameterizedAttributeValue_block_invoke + 50
frame #21: 0x0000000130ef0f99 AXRuntime`_handleNonMainThreadCallback + 55
frame #22: 0x0000000130ef14cb AXRuntime`_AXXMIGCopyParameterizedAttributeValue + 285
frame #23: 0x0000000130eec976 AXRuntime`AXUIElementCopyParameterizedAttributeValue + 495
frame #24: 0x0000000130e80351 XCTAutomationSupport`-[XCTAccessibilityFramework userTestingSnapshotForElement:options:error:] + 420
frame #25: 0x0000000130e77e90 XCTAutomationSupport`-[XCTElementSnapshotRequest(PlatformImplementation) accessibilitySnapshotOrError:] + 1263
frame #26: 0x0000000130e8305f XCTAutomationSupport`__56-[XCTElementSnapshotRequest loadSnapshotAndReturnError:]_block_invoke_2 + 64
frame #27: 0x0000000130e728dd XCTAutomationSupport`__XCTPerformOnMainRunLoop_block_invoke + 295
frame #28: 0x0000000111251aec CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #29: 0x00000001112512b0 CoreFoundation`__CFRunLoopDoBlocks + 336
frame #30: 0x000000011124c10b CoreFoundation`__CFRunLoopRun + 2747
frame #31: 0x000000011124b302 CoreFoundation`CFRunLoopRunSpecific + 626
frame #32: 0x000000011748d2fe GraphicsServices`GSEventRunModal + 65
frame #33: 0x0000000119ea2ba2 UIKitCore`UIApplicationMain + 140
* frame #34: 0x000000010d2afa4b Musify`main at AppDelegate.swift:20:7
frame #35: 0x0000000113721541 libdyld.dylib`start + 1
frame #36: 0x0000000113721541 libdyld.dylib`start + 1
And here is a trace for a recording crash:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000107c223d0 libsystem_platform.dylib`_platform_strcmp + 80
frame #1: 0x00000001269186f1 UIKit`-[UIViewAccessibility _accessibilityRetrieveIvarText] + 364
frame #2: 0x0000000126905e54 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewIvarsText] + 118
frame #3: 0x0000000126906b27 UIKit`-[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText:] + 2749
frame #4: 0x00000001269099c1 UIKit`-[UITableViewCellAccessibility accessibilityLabel] + 123
frame #5: 0x0000000123633739 PreferencesFramework`-[UITableViewCellAccessibility__Preferences__UIKit accessibilityLabel] + 327
frame #6: 0x0000000126b4f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #7: 0x0000000126b4f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #8: 0x00000001268e620e UIKit`-[UINavigationBarAccessibility_UIViewAccessibilityAdditions _accessibilityAXAttributedLabel] + 650
frame #9: 0x000000012691b711 UIKit`-[UITableViewCellAccessibilityElement accessibilityLabel] + 48
frame #10: 0x0000000126b4f31c UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityPotentiallyAttributedValueForNonAttributedSelector:attributedSelector:] + 244
frame #11: 0x0000000126b4f478 UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityAXAttributedLabel] + 41
frame #12: 0x0000000126b4e9ae UIAccessibility`-[NSObject(AXPrivCategory) _accessibilityProcessedLabelAttribute] + 34
frame #13: 0x0000000126b52c32 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 268
frame #14: 0x0000000126b7cacd UIAccessibility`_accessibilityAttributesForObject + 493
frame #15: 0x0000000126b7c43a UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1239
frame #16: 0x0000000126b7dfd9 UIAccessibility`-[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 1139
frame #17: 0x0000000126b51f09 UIAccessibility`-[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 8537
frame #18: 0x00000001268db100 UIKit`-[UIApplicationAccessibility accessibilityAttributeValue:forParameter:] + 290
frame #19: 0x0000000126b34657 UIAccessibility`_copyParameterizedAttributeValueCallback + 434
frame #20: 0x00000001260bf629 AXRuntime`___AXXMIGCopyParameterizedAttributeValue_block_invoke + 50
frame #21: 0x00000001260bef99 AXRuntime`_handleNonMainThreadCallback + 55
frame #22: 0x00000001260bf4cb AXRuntime`_AXXMIGCopyParameterizedAttributeValue + 285
frame #23: 0x00000001260b94f0 AXRuntime`_XCopyParameterizedAttributeValue + 414
frame #24: 0x00000001260ce1b7 AXRuntime`mshMIGPerform + 237
frame #25: 0x00000001053ea419 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
frame #26: 0x00000001053e9a7b CoreFoundation`__CFRunLoopDoSource1 + 459
frame #27: 0x00000001053e400a CoreFoundation`__CFRunLoopRun + 2490
frame #28: 0x00000001053e3302 CoreFoundation`CFRunLoopRunSpecific + 626
frame #29: 0x000000010b62c2fe GraphicsServices`GSEventRunModal + 65
frame #30: 0x000000010e822ba2 UIKitCore`UIApplicationMain + 140
* frame #31: 0x00000001013dea4b Musify`main at AppDelegate.swift:20:7
frame #32: 0x00000001078c0541 libdyld.dylib`start + 1
frame #33: 0x00000001078c0541 libdyld.dylib`start + 1
By the way, recording and tapping on elements also crashes.
EDIT 2:
I figured out that using the Accessibility Identifier the App also crashes.. So I just need to hover over the Simulator to make the app crash. I am out of ideas :(

main thread was blocked when i use UIWebView

Today i find a bug in my app relate to UIWebView, there are two case for it, the url i request is https://estore-cn.pandora.net/Bracelets-1/
When I use UIWebView to show a web page, and I exit that page, the webView's dealloc been called, but the UI thread been blocked, and several minutes later it recovers.
This is the thread stack here when I press pause program execution button in Xcode.
* thread #1: tid = 0x580710, 0x0000000180da3f6c libsystem_kernel.dylib`__psynch_mutexwait + 8, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x0000000180da3f6c libsystem_kernel.dylib`__psynch_mutexwait + 8
frame #1: 0x0000000180e7239c libsystem_pthread.dylib`_pthread_mutex_lock_wait + 96
frame #2: 0x0000000180e7257c libsystem_pthread.dylib`_pthread_mutex_lock_slow + 296
frame #3: 0x00000001850dc3b0 WebCore`_WebTryThreadLock(bool) + 52
frame #4: 0x00000001850dcb3c WebCore`WebThreadLock + 108
frame #5: 0x00000001865abfc0 UIKit`-[UIWebView dealloc] + 36
frame #6: 0x000000010032ba64 QDaily`-[QDWebView dealloc](self=0x00000001575f3980, _cmd="dealloc") + 148 at QDWebView.m:63
frame #7: 0x0000000180889ae8 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 508
frame #8: 0x00000001810e89fc CoreFoundation`_CFAutoreleasePoolPop + 28
frame #9: 0x00000001811bebc0 CoreFoundation`__CFRunLoopRun + 1636
frame #10: 0x00000001810e8c50 CoreFoundation`CFRunLoopRunSpecific + 384
frame #11: 0x00000001829d0088 GraphicsServices`GSEventRunModal + 180
frame #12: 0x00000001863d6088 UIKit`UIApplicationMain + 204
frame #13: 0x000000010037490c QDaily`main(argc=1, argv=0x000000016fd03af0) + 172 at main.m:16
frame #14: 0x0000000180c868b8 libdyld.dylib`start + 4
second case is ,when i begin skip into the webView page, the same case happened.
thread #1: tid = 0x5801dc, 0x0000000180da3f6c libsystem_kernel.dylib`__psynch_mutexwait + 8, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x0000000180da3f6c libsystem_kernel.dylib`__psynch_mutexwait + 8
frame #1: 0x0000000180e7239c libsystem_pthread.dylib`_pthread_mutex_lock_wait + 96
frame #2: 0x0000000180e7257c libsystem_pthread.dylib`_pthread_mutex_lock_slow + 296
frame #3: 0x00000001850dc3b0 WebCore`_WebTryThreadLock(bool) + 52
frame #4: 0x00000001850dcb3c WebCore`WebThreadLock + 108
frame #5: 0x00000001867f3dc4 UIKit`-[UIWebView _webViewCommonInitWithWebView:scalesPageToFit:] + 128
frame #6: 0x00000001865a83ec UIKit`-[UIWebView initWithFrame:] + 80
frame #7: 0x00000001002abb60 QDaily`-[QDWebView initWithFrame:](self=0x0000000000000000, _cmd="initWithFrame:", frame=(origin = (x = 0, y = 20), size = (width = 414, height = 666))) + 120 at QDWebView.m:71
frame #8: 0x0000000100212244 QDaily`-[QDSimpleWebViewController viewDidLoad](self=0x0000000131225070, _cmd="viewDidLoad") + 796 at QDSimpleWebViewController.m:57
frame #9: 0x000000018636cc40 UIKit`-[UIViewController loadViewIfRequired] + 996
frame #10: 0x00000001863850d0 UIKit`-[UIViewController __viewWillAppear:] + 132
frame #11: 0x000000018651fe5c UIKit`-[UINavigationController _startCustomTransition:] + 1052
frame #12: 0x000000018642be40 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 688
frame #13: 0x000000018642bb1c UIKit`-[UINavigationController __viewWillLayoutSubviews] + 60
frame #14: 0x000000018642ba84 UIKit`-[UILayoutContainerView layoutSubviews] + 208
frame #15: 0x00000001863681e4 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
frame #16: 0x0000000183cf698c QuartzCore`-[CALayer layoutSublayers] + 148
frame #17: 0x0000000183cf15c8 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 292
frame #18: 0x0000000183cf1488 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
frame #19: 0x0000000183cf0ab8 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 252
frame #20: 0x0000000183cf0818 QuartzCore`CA::Transaction::commit() + 500
frame #21: 0x000000018636aff4 UIKit`_UIApplicationHandleEventQueue + 4980
frame #22: 0x00000001811c109c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #23: 0x00000001811c0b30 CoreFoundation`__CFRunLoopDoSources0 + 540
frame #24: 0x00000001811be830 CoreFoundation`__CFRunLoopRun + 724
frame #25: 0x00000001810e8c50 CoreFoundation`CFRunLoopRunSpecific + 384
frame #26: 0x00000001829d0088 GraphicsServices`GSEventRunModal + 180
frame #27: 0x00000001863d6088 UIKit`UIApplicationMain + 204
frame #28: 0x00000001002f490c QDaily`main(argc=1, argv=0x000000016fd83af0) + 172 at main.m:16
frame #29: 0x0000000180c868b8 libdyld.dylib`start + 4
I don't know how to resolve it
ADD: this is the webThread when happened dead lock
* thread #19: tid = 0x58076c, 0x00000001854180f0 WebCore`WTF::HashMap<unsigned long, WTF::RefPtr<WebCore::ResourceLoader>, WTF::IntHash<unsigned long>, WTF::HashTraits<unsigned long>, WTF::HashTraits<WTF::RefPtr<WebCore::ResourceLoader> > >::remove(unsigned long const&) + 164, name = 'WebThread'
* frame #0: 0x00000001854180f0 WebCore`WTF::HashMap<unsigned long, WTF::RefPtr<WebCore::ResourceLoader>, WTF::IntHash<unsigned long>, WTF::HashTraits<unsigned long>, WTF::HashTraits<WTF::RefPtr<WebCore::ResourceLoader> > >::remove(unsigned long const&) + 164
frame #1: 0x0000000185126e54 WebCore`WebCore::DocumentLoader::removeSubresourceLoader(WebCore::ResourceLoader*) + 40
frame #2: 0x00000001851292a0 WebCore`WebCore::ResourceLoader::cancel(WebCore::ResourceError const&) + 492
frame #3: 0x0000000185087764 WebCore`WebCore::ResourceLoader::init(WebCore::ResourceRequest const&) + 404
frame #4: 0x00000001850873fc WebCore`WebCore::SubresourceLoader::startLoading() + 36
frame #5: 0x000000018508735c WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadScheduler::HostInformation*, WebCore::ResourceLoadPriority) + 516
frame #6: 0x00000001851070b8 WebCore`WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadPriority) + 412
frame #7: 0x0000000185079f1c WebCore`WebCore::ThreadTimers::sharedTimerFiredInternal() + 148
frame #8: 0x0000000185079e5c WebCore`WebCore::timerFired(__CFRunLoopTimer*, void*) + 36
frame #9: 0x00000001811c1794 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
frame #10: 0x00000001811c1438 CoreFoundation`__CFRunLoopDoTimer + 884
frame #11: 0x00000001811beb4c CoreFoundation`__CFRunLoopRun + 1520
frame #12: 0x00000001810e8c50 CoreFoundation`CFRunLoopRunSpecific + 384
frame #13: 0x00000001850da108 WebCore`RunWebThread(void*) + 456
frame #14: 0x0000000180e6fb28 libsystem_pthread.dylib`_pthread_body + 156
frame #15: 0x0000000180e6fa8c libsystem_pthread.dylib`_pthread_start + 156
frame #16: 0x0000000180e6d028 libsystem_pthread.dylib`thread_start + 4
ADD: JavaScriptCore :: Marking thread
* thread #20: tid = 0x58076d, 0x0000000180da3f24 libsystem_kernel.dylib`__psynch_cvwait + 8, name = 'JavaScriptCore::Marking'
* frame #0: 0x0000000180da3f24 libsystem_kernel.dylib`__psynch_cvwait + 8
frame #1: 0x0000000180e6ece8 libsystem_pthread.dylib`_pthread_cond_wait + 648
frame #2: 0x00000001807fb42c libc++.1.dylib`std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
frame #3: 0x0000000184bc0d5c JavaScriptCore`JSC::GCThread::waitForNextPhase() + 144
frame #4: 0x0000000184bc0df4 JavaScriptCore`JSC::GCThread::gcThreadMain() + 84
frame #5: 0x0000000184896614 JavaScriptCore`WTF::threadEntryPoint(void*) + 212
frame #6: 0x0000000184896524 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 24
frame #7: 0x0000000180e6fb28 libsystem_pthread.dylib`_pthread_body + 156
frame #8: 0x0000000180e6fa8c libsystem_pthread.dylib`_pthread_start + 156
frame #9: 0x0000000180e6d028 libsystem_pthread.dylib`thread_start + 4

EXC_BAD_ACCESS (code=1, address=0x0)

I have a piece of code which runs correctly in real device but is giving EXC_BAD_ACCESS (code=1, address=0x0) error in simulator (iphone 6) :
The bt output is:
(lldb) bt
* thread #1: tid = 0xe40f6, 0x00000001052ab5e9 CoreFoundation`CFArrayGetCount + 25, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001052ab5e9 CoreFoundation`CFArrayGetCount + 25
* frame #1: 0x0000000104c6a5af MyApp`static MyApp.SSID.fetchSSIDInfo (self=MyApp.SSID)() -> Swift.String + 95 at WifiGetter.swift:17
frame #2: 0x0000000104c4994a MyApp`MyApp.TableViewController.sendWifi (self=0x00007ff05a64da80)() -> () + 26 at TableViewController.swift:355
frame #3: 0x0000000104c49316 MyApp`MyApp.TableViewController.fetchData (self=0x00007ff05a64da80)() -> () + 38 at TableViewController.swift:308
frame #4: 0x0000000104c4567f MyApp`MyApp.TableViewController.viewDidLoad (self=0x00007ff05a64da80)() -> () + 3215 at TableViewController.swift:66
frame #5: 0x0000000104c45ea2 MyApp`#objc MyApp.TableViewController.viewDidLoad (MyApp.TableViewController)() -> () + 34 at TableViewController.swift:0
frame #6: 0x00000001063c9931 UIKit`-[UIViewController loadViewIfRequired] + 1344
frame #7: 0x000000010640cc26 UIKit`-[UINavigationController _layoutViewController:] + 54
frame #8: 0x000000010640d4dd UIKit`-[UINavigationController _updateScrollViewFromViewController:toViewController:] + 433
frame #9: 0x000000010640d633 UIKit`-[UINavigationController _startTransition:fromViewController:toViewController:] + 116
frame #10: 0x000000010640e879 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 890
frame #11: 0x000000010640f67d UIKit`-[UINavigationController __viewWillLayoutSubviews] + 57
frame #12: 0x00000001065a763d UIKit`-[UILayoutContainerView layoutSubviews] + 248
frame #13: 0x00000001062ef11c UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
frame #14: 0x000000010c35836a QuartzCore`-[CALayer layoutSublayers] + 146
frame #15: 0x000000010c34cbd0 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 366
frame #16: 0x000000010c34ca4e QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
frame #17: 0x000000010c3411d5 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 277
frame #18: 0x000000010c36e9f0 QuartzCore`CA::Transaction::commit() + 508
frame #19: 0x000000010c36f154 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #20: 0x00000001053079d7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #21: 0x0000000105307947 CoreFoundation`__CFRunLoopDoObservers + 391
frame #22: 0x00000001052fcebc CoreFoundation`CFRunLoopRunSpecific + 524
frame #23: 0x000000010623998d UIKit`-[UIApplication _run] + 402
frame #24: 0x000000010623e676 UIKit`UIApplicationMain + 171
frame #25: 0x0000000104c20efd MyApp`main + 109 at AppDelegate.swift:20
frame #26: 0x0000000108ea592d libdyld.dylib`start + 1
interfaces is nil. You must handle this case. I recommend avoiding !. Making the type non-optional here will allow the if let binding to work correctly.
You should change your if let clause to if let interfaces = CNCopySupportedInterfaces() as? CFArray.
Because you use if let interfaces: CFArray! with ! mean force unwrap, therefore, when CNCopySupportedInterfaces() return nil or value which is not convertible to CFArray, force unwrap will cause crash

Navigation to Different view results in SIGABRT error

I am new to Objective C, and cannot figure out the error I am facing right now. The app was developed by some other developer few years back, and I just have to change some images and upload back as new version (and underline API/webservice got updated). Everything was done fine, but one button in app is causing a crash.
We have two button in our main interface, one shows the listing near by user location, which works, and we have another to show all listing. The calling method for them is same, but when we use Show all listing interface in code it crash application with no error. in Debugger it shows (lldb) and generate SIGABRT in main appdelegate call.
Here is the button code
-(IBAction)btnAllResturantAction:(id)sender
{
[btnAllRestaruant setImage:[UIImage imageNamed:#"all_restaurants_tapped.png"] forState:UIControlStateNormal];
NSLog(#"SearchView : Button CLick for All Resturant");
#try {
HomeViewController *homeView1=[[HomeViewController alloc]initWithNibName:#"HomeViewController" bundle:nil];
[self.navigationController pushViewController:homeView1 animated:YES];
NSLog(#"SearchView: Button CLick complete");
} #catch (NSException *exception){
NSLog(#"Search View: Exception in All Resturant %#", exception.reason);
}
}
When in line by line debug, I can see Log message of "Button Click complete" visible in debugger window, but just after that it fail and crash application, I didn't see any other error message even after I try bt in Debugger window, it shows all framework code. Here is bt result anyways
* thread #1: tid = 0x129d3, 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x04617664 libsystem_pthread.dylib`pthread_kill + 101
frame #2: 0x043c539d libsystem_c.dylib`abort + 156
frame #3: 0x002ff065 project6`uncaught_exception_handler + 38
frame #4: 0x03eabebe CoreFoundation`__handleUncaughtException + 830
frame #5: 0x0396d0ae libobjc.A.dylib`_objc_terminate() + 100
frame #6: 0x04687d0d libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x0468793e libc++abi.dylib`__cxa_rethrow + 103
frame #8: 0x0396cfad libobjc.A.dylib`objc_exception_rethrow + 47
frame #9: 0x03dba7d0 CoreFoundation`CFRunLoopRunSpecific + 672
frame #10: 0x03dba51b CoreFoundation`CFRunLoopRunInMode + 123
frame #11: 0x056ef664 GraphicsServices`GSEventRunModal + 192
frame #12: 0x056ef4a1 GraphicsServices`GSEventRun + 104
frame #13: 0x006941eb UIKit`UIApplicationMain + 160
frame #14: 0x000abf7a project6`main(argc=1, argv=0xbff5587c) + 138 at main.m:14
frame #15: 0x0431ea21 libdyld.dylib`start + 1
Can you guide me where and how I look for error, with this information.
EDIT:
I add Exception Breakpoint which generate this bt
(lldb) bt
thread #1: tid = 0x1368d, 0x03996dd0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
frame #0: 0x03996dd0 libobjc.A.dylib`objc_exception_throw
frame #1: 0x03ed59ad CoreFoundation`+[NSException raise:format:] + 141
frame #2: 0x008873cb UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 740
frame #3: 0x00887ccc UIKit`-[UIViewController loadView] + 189
frame #4: 0x008880d8 UIKit`-[UIViewController loadViewIfRequired] + 154
frame #5: 0x0088ebde UIKit`-[UIViewController __viewWillAppear:] + 114
frame #6: 0x008b1d37 UIKit`-[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 202
frame #7: 0x008c4009 UIKit`-[UINavigationController _startCustomTransition:] + 1389
frame #8: 0x008d5bf5 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 803
frame #9: 0x008d6e3b UIKit`-[UINavigationController __viewWillLayoutSubviews] + 68
frame #10: 0x00ab2193 UIKit`-[UILayoutContainerView layoutSubviews] + 252
frame #11: 0x00787eb7 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 813
frame #12: 0x039ab059 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #13: 0x0586780a QuartzCore`-[CALayer layoutSublayers] + 144
frame #14: 0x0585b4ee QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 388
frame #15: 0x0585b352 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #16: 0x0584de8b QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 317
frame #17: 0x05881e03 QuartzCore`CA::Transaction::commit() + 561
frame #18: 0x05883674 QuartzCore`CA::Transaction::flush_transaction() + 50
frame #19: 0x006b7f0a UIKit`_UIApplicationHandleEventQueue + 8398
frame #20: 0x03defd1f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #21: 0x03de59ab CoreFoundation`__CFRunLoopDoSources0 + 523
frame #22: 0x03de4dc8 CoreFoundation`__CFRunLoopRun + 1032
frame #23: 0x03de4706 CoreFoundation`CFRunLoopRunSpecific + 470
frame #24: 0x03de451b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x05719664 GraphicsServices`GSEventRunModal + 192
frame #26: 0x057194a1 GraphicsServices`GSEventRun + 104
frame #27: 0x006be1eb UIKit`UIApplicationMain + 160
frame #28: 0x000d5f7a project6`main(argc=1, argv=0xbff2b87c) + 138 at main.m:14
frame #29: 0x04348a21 libdyld.dylib`start + 1

How to fix MP3AudioStream error?

I'm getting the following error randomly (and sometimes consistently on launch). It can happen when there are background threads and when there aren't and it seems to be a problem with the library so I'm having trouble tracking down the problem in my code. The breakpoint triggers on:
#0 0x07bb489b in MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) ()
and the backtrace is as follows:
* thread #1: tid = 0x1c03, 0x07bb489b AudioToolbox`MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) + 2843, stop reason = EXC_BAD_ACCESS (code=2, address=0x4)
frame #0: 0x07bb489b AudioToolbox`MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) + 2843
frame #1: 0x07b92535 AudioToolbox`AudioFileStreamWrapper::ParseBytes(unsigned long, void const*, unsigned long) + 181
frame #2: 0x07b8f41d AudioToolbox`AudioFileStreamParseBytes + 93
frame #3: 0x07f7a1be MediaToolbox`PushBytesThroughParser + 484
frame #4: 0x07f7a69a MediaToolbox`GetAudioFileStreamPacketAndFrameCount + 221
frame #5: 0x07f7c57e MediaToolbox`FigAudioFileStreamFormatReaderCopyProperty + 225
frame #6: 0x07f9bd1d MediaToolbox`FigPlaybackBossGetDuration + 165
frame #7: 0x07f9f75a MediaToolbox`FigPlaybackBossSetTimeWithRange + 192
frame #8: 0x07f66bef MediaToolbox`itemfig_rebuildRenderPipelinesAndBoss + 10196
frame #9: 0x07f63f01 MediaToolbox`playerfig_prepareWorkingItem2 + 117
frame #10: 0x07f5bdb9 MediaToolbox`playerfig_prepareWorkingItem + 88
frame #11: 0x07f6c536 MediaToolbox`itemfig_assetPropertyBatchLoaded_prepareWorkingItem + 125
frame #12: 0x01bc8758 CoreMedia`figDeferredNotificationRun + 69
frame #13: 0x01de4376 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
frame #14: 0x01de3e06 CoreFoundation`__CFRunLoopDoTimer + 534
frame #15: 0x01dcba82 CoreFoundation`__CFRunLoopRun + 1810
frame #16: 0x01dcaf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #17: 0x01dcae1b CoreFoundation`CFRunLoopRunInMode + 123
frame #18: 0x02afb7e3 GraphicsServices`GSEventRunModal + 88
frame #19: 0x02afb668 GraphicsServices`GSEventRun + 104
frame #20: 0x00330ffc UIKit`UIApplicationMain + 1211
frame #21: 0x00002a7d FMA`main(argc=1, argv=0xbffff3f0) + 141 at main.m:16
Has anyone had this error and does anyone know how I might go about fixing it?

Resources