CHHapticEngine not running - ios

After a day of playing with the CHHapticEngine and custom haptic patterns, using AHAP files in particular (including adding sound samples), I have lost the sound and haptics in the deivce / iPhone. After a factory reset of the iPhone, there are still no haptics / sound in the device (no ringer, no vibrations etc.). When trying to start the haptics engine and play any pattern I can see the following output in the Xcode debugger:
2020-04-29 19:44:31.034051+0200 ProjectName[18431:5043001] [hapi] CHHapticEngine.mm:2354:-[CHHapticEngine doStartWithCompletionHandler:]_block_invoke: ERROR: Player start failed: The operation couldn’t be completed. (com.apple.CoreHaptics error 1852797029.)
2020-04-29 19:44:31.034398+0200 ProjectName[18431:5042880] [Feedback] failed to start core haptics engine for <_UIFeedbackCoreHapticsEngine: 0x28268f170>: Error Domain=com.apple.CoreHaptics Code=1852797029 "(null)"
2020-04-29 19:44:34.076491+0200 ProjectName[18431:5043124] [hapi] CHHapticEngine.mm:2354:-[CHHapticEngine doStartWithCompletionHandler:]_block_invoke: ERROR: Player start failed: The operation couldn’t be completed. (com.apple.CoreHaptics error 1852797029.)
2020-04-29 19:44:34.076703+0200 ProjectName[18431:5043124] [hapi] HapticUtils.h:56:_Haptic_Check: -[CHHapticEngine checkEngineState:]: self.running error -4805
2020-04-29 19:44:34.077641+0200 ProjectName[18431:5043124] error = Error Domain=com.apple.CoreHaptics Code=-4805 "(null)" UserInfo={Error =self.running}
The question is, is it probable to damage the hardware from code?

Related

Starting AudioKit results in AudioHAL_Client errors 50% of the time

I've been using AudioKit for over 8 months, but recently I've run into a weird issue.
When I start AudioKit, in (roughly) 50% of the cases the audio stops playing after a few seconds and I get a stream of lower-level AudioHAL_Client errors:
2019-03-14 17:17:15.567027+0100 TestApp[68164:1626512] [AudioHAL_Client] HALC_ProxyIOContext.cpp:1399:IOWorkLoop: HALC_ProxyIOContext::IOWorkLoop: failed to send the final message to the server, Error: 0x10000003
2019-03-14 17:17:16.104180+0100 TestApp[68164:1626365] [AudioHAL_Client] HALC_ShellPlugIn.cpp:817:HAL_HardwarePlugIn_ObjectHasProperty: HAL_HardwarePlugIn_ObjectHasProperty: no object
or:
2019-03-15 08:15:33.756244+0100 macOSDevelopment[47186:2925180] [AudioHAL_Client] HALC_ProxyIOContext.cpp:1399:IOWorkLoop: HALC_ProxyIOContext::IOWorkLoop: failed to send the final message to the server, Error: 0x10000003
2019-03-15 08:15:34.290366+0100 macOSDevelopment[47186:2925038] [AudioHAL_Client] HALC_ShellPlugIn.cpp:817:HAL_HardwarePlugIn_ObjectHasProperty: HAL_HardwarePlugIn_ObjectHasProperty: no object
2019-03-15 08:15:34.290431+0100 macOSDevelopment[47186:2925038] [AudioHAL_Client] HALC_ShellPlugIn.cpp:817:HAL_HardwarePlugIn_ObjectHasProperty: HAL_HardwarePlugIn_ObjectHasProperty: no object
It is not related to my specific app, because when I build the AudioKit macOS development app, the same happens. I've also tried it with a clean macOS project.
This is enough to trigger the bug:
AudioKit.output = AKMixer()
AudioKit.start()
Same happens when I connect an AKOscillator instead of AKMixer.
I've tried to debug this, but I cannot figure out what's going wrong.

How do I stop AudioKit Inputs and Outputs efficiently and definitively?

I've been using Audiokit.stop() to reasonable effect, and some minor issues that I'd like to resolve now. With the recent update to Audiokit 4.2, I'm now getting a (very useful) error message from the following code:
do {
try AudioKit.stop()
} catch {
AKLog("AudioKit did not stop!")
}
My error code is this:
2018-04-24 16:14:48.099606+0100 MyProject[517:62626] [avas] AVAudioSession.mm:1142:
-[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has
running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
AudioKit.swift:stop():299:couldn't stop session
Error Domain=NSOSStatusErrorDomain Code=560030580 "(null)"
GameScene.swift:update:755:AudioKit did not stop!
So my question is - how do I properly stop or pause all inputs and outputs (I/O) as suggested by the error message?

MPMusicPlayerController setCurrentPlaybackRate

The call to setCurrentPlaybackRate to the MPMusicPlayerController stopped working after the latest iOS update, and now gives this error:
2018-04-15 16:24:06.904562-0600 SampleProject[5659:1836398] [SDKPlayback] -
[MPMusicPlayerController setCurrentPlaybackRate:0.670213] completed error:
Error Domain=MPCPlayerRequestErrorDomain Code=1 "No commands provided."
UserInfo={NSDebugDescription=No commands provided.}
I'm passing in a valid double value greater than 0 and less than 2.
This is the call:
[appMusicPlayer setCurrentPlaybackRate:0.7];
Thanks for any input or help!
P.S. I'm getting a lot of other weird errors too. Here are some:
2018-04-15 17:30:01.976932-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed validators: {(
setRepeatMode
)}
2018-04-15 17:30:03.976879-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed to get a valid response. Resetting expectations.
2018-04-15 17:30:01.976932-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed validators: {(
setRepeatMode
)}
2018-04-15 17:30:03.976879-0600 SampleProject[5733:1868672] [SDKPlayback]
Failed to get a valid response. Resetting expectations.
I just encountered the same issue when trying to use player.append(MPMusicPlayerQueueDescriptor). I found that it would return the same error when the queue for my MPMusicPlayerController was quite large. When I cut it down to around 10, it works with no issues. I haven't experimented to see the maximum I can add to the queue.
I hope this helps, perhaps a smaller queue will also work for you.

AVCaptureDevice flashMode not working

In an app using AVCaptureSession and AVCaptureDevice, I am taking pictures and it goes as expected.
I decided to implement the use of the flash and there troubles are coming.
Here is the code I added, after searching on the net on how to use the flash in an iOS app:
if captureDevice.hasFlash && captureDevice.isFlashModeSupported(.On) {
do {try captureDevice.lockForConfiguration()
} catch let error as NSError {
print("captureDevice.lockForConfiguration FAILED")
print(error.code)
}
captureDevice.flashMode = .On
captureDevice.unlockForConfiguration()
captureSession.commitConfiguration()
}
It compiles OK but when I try to take a photo, the app crashes with the following error:
Error on taking a picture:
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation couldn’t be completed." UserInfo={NSUnderlyingError=0x14e176f40 {Error Domain=NSOSStatusErrorDomain Code=-16800 "(null)"}, NSLocalizedFailureReason=Undefined error(-16800), NSLocalizedDescription=The operation couldn’t be completed.}
Since I have never used the flash before, it may well be a newbie error. But I haven’t, at this point, been able to figure out what was wrong.
If anyone has experience using the flash in an app, please let me know what may be the issue.

iCloud fails with core data - partial updates - undocumented error message

I am trying to sync the data of a core data app between two devices via iCloud. It basically seems to work, but it mostly fails. Data does not show up, or shows up randomly / partially. Sync takes forever (sometimes: hours).
Of course I tried all obvious remedies such as deleting the apps and data from the devices etc.
I get the following messages (relevant excerpt):
[_PFUbiquityRecordsImporter operation:failedWithError:](839):
CoreData: Ubiquity: Import operation encountered an error:
Error Domain=NSCocoaErrorDomain
Code=134060 "The operation couldn’t be completed.
(Cocoa error 134060.)" UserInfo=0x1106a6a0
{exception=Attempted to perform an operation without an open database}
while trying to import the log file at the URL:
<PFUbiquityTransactionLog: 0x11062710>
right after
CoreData: Ubiquity: Error importing transaction log:
<PFUbiquityTransactionLog: 0x110eb820>
and later
-[_PFUbiquityRecordsImporter operation:failedWithError:](824):
CoreData: Ubiquity: Import operation encountered a corrupt log file,
Error Domain=NSCocoaErrorDomain Code=134302
"The operation couldn’t be completed. (Cocoa error 134302.)"
UserInfo=0x12e0b0 {underlyingError=Error Domain=NSCocoaErrorDomain Code=19
"The operation couldn’t be completed. (Cocoa error 19.)" UserInfo=0x1af070
{NSUnderlyingException=error during SQL execution : constraint failed,
NSFilePath=/var/mobile/Applications/
59087988-334C-40DC-9F6A-C7DA22F7B790/Documents/database.sqlite,
NSSQLiteErrorDomain=19}, reason=Error encountered while importing
transaction log at URL: <PFUbiquityTransactionLog: 0xe87b3f0>
Any clues about this "without an open database" error?
What to do about the "corrupt log file"?

Resources