my Xcode says Type 'AVAudioApplication.recordPermission.Type' has no member 'granted’
This is why?
but in AVAudioSession.sharedInstance().recordPermission, such an error indicator doesn’t appear.
my Xcode says Type 'AVAudioApplication.recordPermission.Type' has no member 'granted’
This is why?
but in AVAudioSession.sharedInstance().recordPermission, such an error indicator doesn’t appear.
recordPermission is defined as an instance member, not a static member. So when you write AVAudioApplication.recordPermission you’re attempting to access a static member recordPermission which doesn’t exist.
AVAudioSession.sharedInstance().recordPermission attempts to access recordPermission on an instance of AVAudioSession which is why that works.
This is totally confusing because the type of the instance member recordPermission, is an enum with lowercase name also recordPermission.
// Actual declaration
var recordPermission: AVAudioApplication.recordPermission
// Expected declaration
var recordPermission: AVAudioApplication.RecordPermission
thank you for giving reply.
I found out It doesn’t include “.shared” so It could not access an instance.
thank you comment.
yes, both are same name. It seemed I didn’t understand the member is instance or static.
This is totally confusing because …
Well, that’s not good. This problem is rooted in the <AVFAudio/AVAudioApplication.h> header, which has this:
typedef NS_ENUM(NSInteger, AVAudioApplicationRecordPermission) {
…
} NS_SWIFT_NAME(AVAudioApplication.recordPermission);
when it should have this:
typedef NS_ENUM(NSInteger, AVAudioApplicationRecordPermission) {
…
} NS_SWIFT_NAME(AVAudioApplication.RecordPermission);
I filed my own bug about it (r. 163919376).
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple