Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] iOS 11.1+ breaks touch handling when interacting with top or bottom regions of device.

Author
Message
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 2nd Feb 2018 04:22 Edited at: 2nd Feb 2018 07:26
With the latest iOS updates, GetPointerPressed(), GetPointerReleased() and GetPointerState() are not fired if you tap in the top or bottom areas (roughly 20-40pt at either end). GetRawTouhCount also returns 0 (except upon release in these areas where it records '1' for a single frame). You can test this simply with:



If you hold your finger still in these regions for approximately one second, GetPointerPressed() is finally triggered for the first time and then touch count registers correctly. Likewise it behaves correctly if you start to slide your finger when down after a few pixels of movement. But if you have an interface or game component that uses these areas and are monitoring specifically for any touch began/ended events, this will now fail. It seems to be something Apple integrated to make accessing Control Center etc. easier (but the problem persists even if you disable Control Center from apps).

One person who observed this in an app commented on Stack Overflow:

Quote: "It does indeed appear that iOS11.1 changes the timing for touch events at the top and bottom of the screen. Presumably this is in order to handle the new single-swipe gestures for opening notifications and the control center. The touchesBegan events and touchesEnded events appear at almost exactly the same time. ... Apps that follow the pattern of processing touch events into a touch state, and then poll that touch state to detect button presses are likely to break. The approach fails because these touches get removed from the touch state immediately after being added with no opportunity for the polling code to observe them."


Apple does have a method: preferredScreenEdgesDeferringSystemGestures() but I am unsure if that will resolve the issue.

Edit: One quick hack solution to capture 'touch end' in these regions is to monitor GetRawTouchCount(1). Every time that value is > 0, add 1 to a counter. Then when GetRawTouchbCount(1) = 0 you can check the counter and if it equals 1 you can treat it as an OnPointerReleased(), and also reset the counter. Note that this solution can also trigger if the user very quickly taps any area in the scope of 1 frame so you'll want to implement accordingly.

Login to post a reply

Server time is: 2024-04-24 16:17:56
Your offset time is: 2024-04-24 16:17:56