I'm pretty new to Swift and I'm having some trouble implementing alerts into my SpriteKit game. Well, it works however it keeps giving warnings:
2022-06-03 02:04:04.465264+0100 Project14[57880:10648157] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionViewCell that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIAlertControllerTextFieldViewCollectionCell: 0x13ed18d70; frame = (0 24; 270 24); gestureRecognizers = <NSArray: 0x6000009c81b0>; layer = <CALayer: 0x600000713600>>
2022-06-03 02:06:16.239075+0100 Project14[57880:10648157] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
How do I get rid of this warnings? Thanks.
let alert = UIAlertController(title: "title", message: "message", preferredStyle: UIAlertController.Style.alert)
alert.addTextField { field in
field.placeholder = "Input your name"
field.isSecureTextEntry = false
field.textAlignment = .left
}
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in
print("ok")
})
alert.addAction(UIAlertAction(title: "Cancel", style: .default) { _ in
print("cancel")
})
view?.window?.rootViewController?.present(alert, animated: true)
}
I cannot use just present(alert, animated: true). In this case I get compiler error - "Value of type 'SceneMenu' has no member 'present'"