Swift iOS application crashed when I hit on a button that need to take me other viewcontroller -
i developing swift ios application, when tried hit on login button needs pull user information mysql database , have verify user provided values. doing stuff fine. after verifying credential need navigate other view controller, unfortunately app getting crashed @ point , given below error.
2015-09-29 18:15:43.839 iosbudgetmanager[2998:66920] *** assertion failure in -[uikeyboardtaskqueue waituntilalltasksarefinished], /sourcecache/uikit_sim/uikit-3347.44.2/keyboard/uikeyboardtaskqueue.m:374 2015-09-29 18:15:43.867 iosbudgetmanager[2998:66920] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uikeyboardtaskqueue waituntilalltasksarefinished] may called main thread.' *** first throw call stack: ( 0 corefoundation 0x000000010e67cc65 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x0000000110429bb7 objc_exception_throw + 45 2 corefoundation 0x000000010e67caca +[nsexception raise:format:arguments:] + 106 3 foundation 0x000000010ed5b98f -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 195 4 uikit 0x000000010f8b57d6 -[uikeyboardtaskqueue waituntilalltasksarefinished] + 151 5 uikit 0x000000010f356912 -[uikeyboardimpl setdelegate:force:] + 473 6 uikit 0x000000010f6014ad -[uiperipheralhost(uikitinternal) _reloadinputviewsforresponder:] + 1002 7 uikit 0x000000010f609834 -[uiperipheralhost(uikitinternal) _preserveinputviewswithid:animated:reset:] + 504 8 uikit 0x000000010f2994f1 -[uiviewcontroller _presentviewcontroller:modalsourceviewcontroller:presentationcontroller:animationcontroller:interactioncontroller:completion:] + 623 9 uikit 0x000000010f29a76e -[uiviewcontroller _presentviewcontroller:withanimationcontroller:completion:] + 3079 10 uikit 0x000000010f29c6c1 __62-[uiviewcontroller presentviewcontroller:animated:completion:]_block_invoke + 132 11 uikit 0x000000010f29c5e5 -[uiviewcontroller presentviewcontroller:animated:completion:] + 229 12 iosbudgetmanager 0x000000010df507c0 _tffc16iosbudgetmanager14viewcontroller13welcomesigninfs0_fcso8uibuttont_u_ftgsqcso6nsdata_gsqcso13nsurlresponse_gsqcso7nserror__t_ + 6752 13 iosbudgetmanager 0x000000010df50c03 _ttrxfo_ogsqcso6nsdata_ogsqcso13nsurlresponse_ogsqcso7nserror__dt__xfo_itgsqs__gsqs0__gsqs1____it__ + 51 14 iosbudgetmanager 0x000000010df4c131 _tpa__ttrxfo_ogsqcso6nsdata_ogsqcso13nsurlresponse_ogsqcso7nserror__dt__xfo_itgsqs__gsqs0__gsqs1____it__ + 81 15 iosbudgetmanager 0x000000010df50c33 _ttrxfo_itgsqcso6nsdata_gsqcso13nsurlresponse_gsqcso7nserror___it__xfo_ogsqs__ogsqs0__ogsqs1___dt__ + 35 16 iosbudgetmanager 0x000000010df50c9a _ttrxfo_ogsqcso6nsdata_ogsqcso13nsurlresponse_ogsqcso7nserror__dt__xfdcb_dgsqs__dgsqs0__dgsqs1___dt__ + 90 17 cfnetwork 0x00000001117d8beb __49-[__nscflocalsessiontask _task_onqueue_didfinish]_block_invoke + 157 18 foundation 0x000000010ed7f57f __nsblockoperation_is_calling_out_to_a_block__ + 7 19 foundation 0x000000010ecc00b2 -[nsblockoperation main] + 98 20 foundation 0x000000010eca2774 -[__nsoperationinternal _start:] + 645 21 foundation 0x000000010eca2383 __nsoqschedule_f + 184 22 libdispatch.dylib 0x0000000110b2b614 _dispatch_client_callout + 8 23 libdispatch.dylib 0x0000000110b126a7 _dispatch_queue_drain + 2176 24 libdispatch.dylib 0x0000000110b11cc0 _dispatch_queue_invoke + 235 25 libdispatch.dylib 0x0000000110b153b9 _dispatch_root_queue_drain + 1359 26 libdispatch.dylib 0x0000000110b16b17 _dispatch_worker_thread3 + 111 27 libsystem_pthread.dylib 0x0000000110e98a9d _pthread_wqthread + 729 28 libsystem_pthread.dylib 0x0000000110e963dd start_wqthread + 13 ) libc++abi.dylib: terminating uncaught exception of type nsexception
the clue here error notes code trying update app's ui thread other main thread.
2015-09-29 18:15:43.867 iosbudgetmanager[2998:66920] terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uikeyboardtaskqueue waituntilalltasksarefinished] may called main thread.'
after verifying credential need navigate other view controller, unfortunately app getting crashed @ point , given below error.
where ever calling code transition new view controller need wrap call in dispatch_async call main thread - see code below.
dispatch_async(dispatch_get_main_queue(), { //view controller code self.presentviewcontroller(yournewviewcontroller, animated: true, completion: nil) })
if need more detail read apple's grand central dispatch (gcd) reference
Comments
Post a Comment