{"action":"created","issue":{"url":"https://api.github.com/repos/aryaxt/OCMapper/issues/22","labels_url":"https://api.github.com/repos/aryaxt/OCMapper/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/aryaxt/OCMapper/issues/22/comments","events_url":"https://api.github.com/repos/aryaxt/OCMapper/issues/22/events","html_url":"https://github.com/aryaxt/OCMapper/issues/22","id":61373357,"number":22,"title":"ObjectMapper init crashes when running on background thread","user":{"login":"hypherion2","id":9730229,"avatar_url":"https://avatars.githubusercontent.com/u/9730229?v=3","gravatar_id":"","url":"https://api.github.com/users/hypherion2","html_url":"https://github.com/hypherion2","followers_url":"https://api.github.com/users/hypherion2/followers","following_url":"https://api.github.com/users/hypherion2/following{/other_user}","gists_url":"https://api.github.com/users/hypherion2/gists{/gist_id}","starred_url":"https://api.github.com/users/hypherion2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypherion2/subscriptions","organizations_url":"https://api.github.com/users/hypherion2/orgs","repos_url":"https://api.github.com/users/hypherion2/repos","events_url":"https://api.github.com/users/hypherion2/events{/privacy}","received_events_url":"https://api.github.com/users/hypherion2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-14T03:00:49Z","updated_at":"2015-03-14T03:40:14Z","closed_at":null,"body":"When ObjectMapper is initialized in a background thread using GCD (i.e. dispatch_async), an EXC_BAD_ACCESS is thrown sometimes with the following call stack:\r\n\r\n1   0x69290f9 StartWebThread()\r\n2   0x2aad6b0 __pthread_once_handler\r\n3   0x2a9eebe _os_once\r\n4   0x2aad65f pthread_once\r\n5   0x6928e8e WebThreadEnable\r\n6   0x57fd32a +[WebView(WebPrivate) enableWebThread]\r\n7   0x57fa090 WebKitInitialize\r\n8   0x739330 ___UIApplicationLoadWebKit_block_invoke\r\n9   0x2752bef _dispatch_client_callout\r\n10  0x273ca92 dispatch_once_f\r\n11  0x273c922 dispatch_once\r\n12  0x739240 _UIApplicationLoadWebKit\r\n13  0x1e31461 _class_initialize\r\n14  0x1e39fe5 lookUpImpOrForward\r\n15  0x1e39e8d _class_lookupMethodAndLoadCache3\r\n16  0x1e4412f objc_msgSend\r\n17  0x1e2f597 _class_resolveMethod\r\n18  0x1e3a018 lookUpImpOrForward\r\n19  0x1e39e41 lookUpImpOrNil\r\n20  0x1e2f94c class_respondsToSelector\r\n21  0x19d8163 +[NSBundle bundleForClass:]\r\n22  0x190d2e6 -[ObjectMapper populateClassNamesFromMainBundle]\r\n23  0x190ca1d -[ObjectMapper init]\r\n...\r\n27  0x27305ea _dispatch_call_block_and_release\r\n28  0x2752bef _dispatch_client_callout\r\n29  0x273a1ef _dispatch_root_queue_drain\r\n30  0x273bb70 _dispatch_worker_thread3\r\n31  0x2aae1da _pthread_wqthread\r\n\r\nThe offending line is:\r\n `if ([NSBundle bundleForClass:class] == [NSBundle mainBundle])`\r\nin populateClassNamesFromMainBunde where class is sometimes_UICompatibilityTextView or UIWebDocumentView or others (varies on each occurrence). It seems to be classes related to WebKit.\r\nThis is Xcode 6.2 although it happens on 6.1 as well with iOS 8.1 target."},"comment":{"url":"https://api.github.com/repos/aryaxt/OCMapper/issues/comments/79794071","html_url":"https://github.com/aryaxt/OCMapper/issues/22#issuecomment-79794071","issue_url":"https://api.github.com/repos/aryaxt/OCMapper/issues/22","id":79794071,"user":{"login":"aryaxt","id":3460069,"avatar_url":"https://avatars.githubusercontent.com/u/3460069?v=3","gravatar_id":"","url":"https://api.github.com/users/aryaxt","html_url":"https://github.com/aryaxt","followers_url":"https://api.github.com/users/aryaxt/followers","following_url":"https://api.github.com/users/aryaxt/following{/other_user}","gists_url":"https://api.github.com/users/aryaxt/gists{/gist_id}","starred_url":"https://api.github.com/users/aryaxt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aryaxt/subscriptions","organizations_url":"https://api.github.com/users/aryaxt/orgs","repos_url":"https://api.github.com/users/aryaxt/repos","events_url":"https://api.github.com/users/aryaxt/events{/privacy}","received_events_url":"https://api.github.com/users/aryaxt/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T03:40:13Z","updated_at":"2015-03-14T03:40:13Z","body":"Can you post some code? It seems to be working for me. This test passes\r\n\r\n- (void)test\r\n{\r\n\tdispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\r\n\t\tObjectMapper *aMapper = [[ObjectMapper alloc] init];\r\n\t\tXCTAssertNotNil(aMapper);\r\n\t});\r\n}"}}