如何以编程方式确定iPhone是否处于礼貌模式?有没有办法判断耳机是否已连接?
编辑:在世界某些地方也称为静音模式。
答案 0 :(得分:3)
转载自Narender Mugdal:
CFStringRef route;
UInt32 propertySize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_Audi oRoute, &propertySize, &route);
NSString *outputString = (NSString*)route;
//NSLog(@"%@", outputString);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message: outputString delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];