livechat / chat-window-ios

Embeding LiveChat mobile chat window in iOS application
MIT License
24 stars 31 forks source link

Problem using LiveChat #14

Closed llKoull closed 5 years ago

llKoull commented 6 years ago

Hi!

I'm using this library in my App but i detected some crashes in LiveChat.swift line 117

NotificationCenter.default.addObserver(forName: NSNotification.Name.UIApplicationDidBecomeActive, object: nil, queue: nil) { (notification) in self.window.frame = UIApplication.shared.keyWindow!.frame }

Maybe the problem is that keyWindow is nil and when it tries to access, the app gets crashed. Do you think that delaying the execution of self.window.frame = UIApplication.shared.keyWindow!.frame could be a solution?

Thanks and best regards,

Jercik commented 6 years ago

Hi, I can't reproduce your issue, but certainly if UIApplication.shared.keyWindow would be nil, app would crash. I've added if let statement instead of force unwrapping UIApplication.shared.keyWindow!. Please check if issue is fixed in version 2.0.10.

llKoull commented 6 years ago

Great! thanks for your help @Jercik ^_^