mirror of https://github.com/oxen-io/session-ios
work around swift4.2 AudioSession API bug
parent
d8640f60ef
commit
409426d105
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AVFoundation/AVAudioSession.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AVAudioSession (OWS)
|
||||
|
||||
// #RADAR 45397675 http://www.openradar.me/45397675
|
||||
//
|
||||
// A bug in Swift 4.2+ made `AVAudioSession#setCategory:categorywithOptions:error` not accessible
|
||||
// to Swift.
|
||||
//
|
||||
// It's still available via ObjC, so we have an objc-category method which we can call from Swift
|
||||
// which just calls the original `AVAudioSession#setCategory:categorywithOptions:error` method.
|
||||
- (BOOL)ows_setCategory:(AVAudioSessionCategory)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AVAudioSession+OWS.h"
|
||||
|
||||
@implementation AVAudioSession(OWS)
|
||||
|
||||
|
||||
- (BOOL)ows_setCategory:(AVAudioSessionCategory)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError API_AVAILABLE(ios(6.0), watchos(2.0), tvos(9.0)) API_UNAVAILABLE(macos)
|
||||
{
|
||||
return [self setCategory:category withOptions:options error:outError];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue