Core Haptics Engine Player Destruction with Corrupted AHAP Files

Hello,

I've encountered a concerning issue while working with Core Haptics which I believe warrants attention from the community and Apples engineering team. When attempting to play a haptic pattern using the ChHapticEngine.playPattern method with a corrupted AHAP file path, I've observed unexpected behavior. Specifically, the player is immediately destroyed, triggering the notifyWhenPlayersFinished callback with nil error before executing the catch block(catch block is eventually executed), Furthermore, this behavior introduces ambiguity regarding the successful playback of haptic patterns, as corrupted files can produce false positives in error notifications.

Current workaround is simple, AHAP files are JSON formated files at the end of the day, so just try to decode data or create Foundation object from given JSON data. and if this fails then data must not be in expected format(or decoding strategy is off), that way you can guarantee the validity of an AHAP file before passing it to your player.

Michaud Reyna, Senior iOS Engineer

Replies

IMO the problem is that notifyWhenPlayersFinished does not complete with error if attempting to play a haptic pattern using the ChHapticEngine.playPattern method with a corrupted AHAP file path.