Instance Property

resetHandler

A block that the haptic engine calls after recovering from a haptic server error.

Declaration

@property(readwrite, atomic) CHHapticEngineResetHandler resetHandler;

Discussion

If the handler has to reset itself after a server failure, the system calls this block asynchronously. In this block, release all haptic pattern players and recreate them. The system preserves CHHapticPattern objects and CHHapticEngine properties across restarts. Consider trying to restart the engine inside the reset block.

self.hapticEngine.resetHandler = ^{ 
    NSLog(@"Engine reset --> Restarting!");
    [self.hapticEngine startAndReturnError:&error];
};

Callbacks to this block arrive on a non-main thread, so handle them in a thread-safe manner.

See Also

Handling Haptic Engine Resets

CHHapticEngineResetHandler

A typealias for the block that the haptic engine calls after being reset.