UILongPressGestureRecognizer was working on iOS 11 but no longer firing its action method on iOS 12.
I believe the issue may stem more from Xcode 10 than from iOS 12?
I am away from my machine with Xcode 9 so I can't test using Xcode 9 at the moment, but I believe that when building the app via Xcode 9, UILongPressGestureRecognizer was working on both iOS 12 and iOS 11.
Having just updated my iOS 11 device to iOS 12, I can no longer test on iOS 11 either.
TESTS:
- Building from Xcode 10 to development device with iOS 12: UILongPressGestureRecognizer not working
- Downloading from the App Store a build which was archived and submitted using Xcode 10 to a device with iOS 12: UILongPressGestureRecognizer not working
//the viewcontroller is initiated with UIGestureRecognizerDelegate
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress))
//in cellForRowAt:
longPressGesture.minimumPressDuration = 1.0
longPressGesture.delegate = self
longPressGesture.cancelsTouchesInView = false
cell.addGestureRecognizer(longPressGesture)
@objc func longPress(longPressGestureRecognizer: UILongPressGestureRecognizer) {
//never called
}
I also tried adding the gesture recognizer to a button in viewDidLoad to ensure it wasn't an issue with the tableview, and the longPress function is still never called.
Would very much like to get this working again... anybody know if anything has changed in Xcode 10 or iOS 12 that could affect a UILongPressGestureRecognizer?