Gustash / react-native-giphy-keyboard

React Native implementation of the Giphy SDK for iOS and Android
12 stars 9 forks source link

'keyWindow' was deprecated in iOS 13.0 #11

Closed gimwee closed 3 years ago

gimwee commented 3 years ago

getting this error when running the app.

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file react_native_giphy_keyboard/RNGiphyKeyboard.swift, line 12

after some investigation, found out that 'keyWindow' was deprecated in iOS 13.0

and also found a solution , but I am not sure whether this is the best practice for swift as I am not a swift developer :)

Line 12: change to let keyWindow = UIApplication.shared.connectedScenes .filter({$0.activationState == .foregroundActive}) .map({$0 as? UIWindowScene}) .compactMap({$0}) .first?.windows .filter({$0.isKeyWindow}).first

line 67: chnage to self.keyWindow!.rootViewController!.present(giphy, animated: true, completion: { self.giphy = giphy })

hope you guys can take a look when you got the time

Gustash commented 3 years ago

This package has now been deprecated in favor of the official @giphy/react-native-sdk library.