0
votes

I have a main viewcontroller and SWRevealController drawer. When I present a view controller (a zbar scanner) from a button on the main view controller all works well if the navigation drawer is closed. If the navigation drawer is open and the view controller( zbar scanner) is presented, the zbar scanner just hangs.

I call the zbar scanner view controller with self.presentViewController(self.ZBarReader!, animated: true, completion: nil)

I tried to dismiss the navigation drawer view before presenting the zbar view controller let rvc = self.revealViewController() rvc.dismissViewControllerAnimated(true, completion:nil)

but I get the message:"warning attempt to dismiss from view controller while a presentation or dismiss is in progress"

1

1 Answers

0
votes

Solved it by adding a delay between when the navigation drawer was dismissed and the scanner view controller is called

let seconds = 2.0
let delay = seconds * Double(NSEC_PER_SEC)  // nanoseconds per seconds
let dispatchTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))

dispatch_after(dis`enter code here`patchTime, dispatch_get_main_queue(), {

            let rvc = self.revealViewController()
            rvc.dismissViewControllerAnimated(false, completion: nil)                

        })
scanWaitingFunction()