There is no UICollectionViewCall in my code, any suggestion what it can be or how to resolve? You can use the above code to replicate the issue.
Error #2, you were right. thanks
Post
Replies
Boosts
Views
Activity
Debug warning #1 <- that's the only issue now.
While debug warning #2 is displayed only in emulator which can be resolved by disabling "Connect Hardware Keyboard".
After further testing, I noticed that debug warning #1 is displayed on both device and in emulator, while debug warning #2 is displayed only on emulator.
Hi. Sorry for the late reply. Here is the whole code:
GameViewController.swift
import SpriteKit
class GameViewController: UIViewController {
override func viewDidLoad() {
let scene = SceneMenu(size: view.frame.size)
scene.scaleMode = .aspectFill
scene.backgroundColor = .white
let view = view as! SKView
view.presentScene(scene)
}
}
SceneMenu.swift:
import SpriteKit
class SceneMenu: SKScene {
override init(size: CGSize) {
super.init(size: size)
let btnAlert = SKLabelNode(text: "Show Alert")
btnAlert.name = "btn_alert"
btnAlert.fontSize = 20
btnAlert.fontColor = SKColor.blue
btnAlert.fontName = "Avenir"
btnAlert.position = CGPoint(x: size.width / 2, y: size.height / 2)
addChild(btnAlert)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func showAlert() {
let alert = UIAlertController(title: "title", message: "message", preferredStyle: UIAlertController.Style.alert)
alert.addTextField { field in
field.placeholder = "Type your name"
}
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in
print("OK")
})
view?.window?.rootViewController?.present(alert, animated: true)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let location = touch.location(in: self)
let action = atPoint(location)
if action.name == "btn_alert" {
showAlert()
}
}
}
}
The code works, however every time I run the code I get two warnings (on device & in emulator).
Debug warning #1:
2022-06-04 15:31:46.134563+0100 Game16[86767:3617120] [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: 0x122022da0; frame = (0 0; 270 24); gestureRecognizers = <NSArray: 0x600000a97e40>; layer = <CALayer: 0x600000498220>>
Debug warning #2:
2022-06-04 15:32:10.228624+0100 Game16[86767:3617120] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
Any help how to get rid of this warnings would be appreciated. Thanks.