#import <AVFoundation/AVFoundation.h> - (BOOL)isHeadsetPluggedIn { AVAudioSessionRouteDescription* route = [[AVAudioSession sharedInstance] currentRoute]; for (AVAudioSessionPortDescription* desc in [route outputs]) { if ([[desc portType] isEqualToString:AVAudioSessionPortHeadphones]) return YES; } return NO; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-25 14:49:40