UInt32 dataSize;
CFStringRef currentRoute;
currentRoute = NULL;
dataSize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &dataSize, ¤tRoute);
if([(NSString *) currentRoute hasPrefix: @"Headphone"])
{
//插入耳机后想执行的操作
}
如果获取耳机插入的事件
最新推荐文章于 2025-05-30 09:41:08 发布