如何确定外接耳机是否连接到iPhone? [英] How to find out if an external headset is connected to an iPhone?

查看:270
本文介绍了如何确定外接耳机是否连接到iPhone?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检测到用户的外接耳机已插入iPhone的3.5毫米接口或30针接头?我想只将音频输出到外部音频设备,如果没有连接则保持静音。

Is it possible to detect that the user has an external headset plugged into the iPhone's 3.5mm connector or the 30-pin connector? I want to output audio only to an external audio device, and keep silent if nothing is connected.

推荐答案

答案非常相似回答这个问题,但是你想得到 kAudioSessionProperty_AudioRoute 属性而不是。

The answer is very similar to the answer to this question, but you'll want to get the kAudioSessionProperty_AudioRoute property instead.

这篇关于如何确定外接耳机是否连接到iPhone?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆