gpt4 book ai didi

iphone - 检查 iPad 是否处于静音模式

转载 作者:技术小花猫 更新时间:2023-10-29 10:54:17 30 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Detect Silent mode in iOS5?

我已经使用下面的代码检查静音模式是否打开,它在 iPhone 上按预期工作,但在 iPad 上它无论如何都会返回扬声器。

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];
}

关于如何修改它以使其通用的任何想法?

谢谢

丹.

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com