检查的iPad处于静音模式 [英] Check if iPad is in silent mode
本文介绍了检查的iPad处于静音模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
在iOS5中检测静音模式?
我用下面的code,以检查是否静音模式时,它的工作原理在iPhone上,但在iPad上,无论它返回扬声器符合市场预期。
i have used the code below to check if silent mode is on, it works as expected on the iPhone but on the iPad it returns speaker regardless.
CFStringRef state;
UInt32 propertySize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
if (CFStringGetLength(state) == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Silent mode"
message:@"Please turn sound on"
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}
任何想法如何修改它普遍的工作?
Any ideas how to modify it to work universally?
感谢
丹
推荐答案
这SO回答的答案好听一点:
This SO answer answers it nicely:
和有关Gabe的回答,如果他的回答确实使用私有API,苹果将拒绝您的应用程序。
And regarding Gabe's answer, if his answer does indeed use a private API, Apple will reject your app.
这篇关于检查的iPad处于静音模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文