Getting an error when dismissing a view controller, not seen anything like it before, and not much about it on the internet.
heres the error: * Assertion failure in -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished], /SourceCache/UIKit/UIKit-2903.2/Keyboard/UIKeyboardTaskQueue.m:368
a bit of background, i dismiss the view controller after saving some data. the data saves successfully, every time. also, i recently changed the date saving code to run on the main thread for this one method, as i was having some issues saving in the background.
any ideas why this is happening?
Thanks in advance.
You must make sure not only that present/dissmissViewController called on main thread but also you have to make sure that present/dismissViewController is called from the same parent viewController.
For example there are two navigationController children. First child view controller presents the second child for some job that will return thru a delegate (interface). After the job is done second child dismisses itself and calls to delegate(interface) function with have to present another viweController (for example customPopup) -> that's rises the error since the second child view controller is not dismissed when the present of popup called, but already demised when the dismiss of popup called.
So in this case:
will do.
I had the same problem while calling the camera view
Swift syntax for the same problem:
I recieved this error when I was calling
-presentViewController:animated:completion:
on a thread that was not the main thread (from a callback in a network request). The solution is to dispatch your calls to present and dismiss view controllers to the main thread:If someone is having Assertion Failure issue then here is the solution for Swift 3:
Tested On: Xcode 8.3.2 and Swift 3.1
Make sure to dismiss the view controller from the presenting view.
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html