internal/uidriver/mobile: bug fix: specify a shared AVAudioSession for CHHapticEngine

Closes #1976
This commit is contained in:
Hajime Hoshi 2022-01-26 23:52:41 +09:00
parent eabd82cda0
commit 12de3a7749

View File

@ -17,8 +17,9 @@
package mobile
// #cgo LDFLAGS: -framework CoreHaptics
// #cgo LDFLAGS: -framework AVFAudio -framework CoreHaptics
//
// #import <AVFAudio/AVFAudio.h>
// #import <CoreHaptics/CoreHaptics.h>
// #include <dispatch/dispatch.h>
//
@ -29,7 +30,11 @@ package mobile
// }
//
// NSError* error = nil;
// CHHapticEngine* engine = [[CHHapticEngine alloc] initAndReturnError:&error];
// // Specify the AVAudioSession's shared instance so that this won't affect
// // the result of `[[AVAudioSession sharedInstance] secondaryAudioShouldBeSilencedHint]` (#1976).
// CHHapticEngine* engine =
// [[CHHapticEngine alloc] initWithAudioSession:[AVAudioSession sharedInstance]
// error:&error];
// if (error) {
// NSLog(@"CHHapticEngine::initAndReturnError failed: %@", error);
// return nil;