Link Search Menu Expand Document

Error Handling

You should wrap your calls into LofeltHaptics in try statements. See: https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html

Error Handling Example

do {
    try haptics.load(dataString! as String)
} catch let error as NSError {
    print("Received an error: (error.localizedDescription)")
}

You can also use the try? or try! variations.

Error Types

In the event you encounter an error message while using the Studio framework for iOS, the tips below can help resolve the issue. If the error persists even after trying these remedies, please submit a bug report to Lofelt with the details of the error you receive.

Function Called Error Message Recovery Steps
init() LofeltHaptics initAndReturnError: Error initialising Core Haptics engine: <error details> Try running your app again. If it fails consistently, please report it to us as a bug.
init() LofeltHaptics: Unable to set realtime policy for the streaming thread.
Message is logged only, not returned in the NSError.
iOS was not able to raise the priority of the haptic streaming thread, which affects the timing of haptic playback. Please report this as a bug.
load() The haptic clip you are attempting to play is of a newer version than what is supported by this framework. Some playback features may not work. Please obtain the latest version of the framework from lofelt.com.
Message is logged only, not returned in the NSError. This is a warning, not an error.
Download the latest version of the Studio framework for iOS and include this in your app.
load() Error loading haptic data: Error validating V0/V1: <error details> 1. Re-export the haptic clip from Studio.
2. Read the file correctly into a String with UTF-8 encoding.
load() Error loading haptic data: Error deserializing V0/V1: <error details> 1. Re-export the haptic clip from Studio.
2. Read the file correctly into a String with UTF-8 encoding.
load() Error loading haptic data: Unsupported version Download the latest version of the Studio framework for iOS and include this in your app.
play() Error playing haptic clip: Unable to play, no clip loaded. Call play() only after a haptic clip was loaded without any errors.
stop() Error stopping haptic clip: Unable to stop, no clip loaded. Call stop() only after play().
attachAudioSource() LofeltHaptics attachAudioSource: Interleaved audio is not supported Only deinterleaved audio is currently supported. Make sure the AVAudioNode you are attaching provides deinterleaved audio.
Playback of realtime audio-to-haptics
These errors are logged during haptic playback only, and not returned from a function.
LofeltHaptics: Could not play haptics generated from audio: <error details> iOS was unable to play back a haptic event. Please report this to us as a bug.
Playback of pre-authored haptic clips
These errors are logged during haptic playback only, and not returned from a function
LofeltHaptics: Could not play amplitude event: <error details> iOS was unable to play back a haptic event. Please report this to us as a bug.
Playback of pre-authored haptic clips
These errors are logged during haptic playback only, and not returned from a function
LofeltHaptics: Could not play frequency event: <error details> iOS was unable to play back a haptic event. Please report this to us as a bug.

< Prev Next >


Copyright © 2020-2021 Lofelt GmbH. All rights reserved.