我不想以编程方式打开/关闭 iPhone 的呼叫等待功能(可在 中找到Settings > Phone > Call Waiting
)。
我发现电话设置从此处找到的类调用-setCallWaitingEnabled:specifier:
方法。我发现它在:PhoneSettingsCallWaitingController
/System/Library/PreferenceBundles/MobilePhoneSettings.bundle/Call Waiting.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>id</key>
<string>com.apple.preferences.phone.call-waiting</string>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>get</key>
<string>callWaitingEnabled:</string>
<key>label</key>
<string>Call Waiting</string>
<key>set</key>
<string>setCallWaitingEnabled:specifier:</string>
</dict>
</array>
<key>title</key>
<string>Call Waiting</string>
</dict>
</plist>
我手动加载了包并初始化了上面的类并调用了我说的方法,但没有任何反应。这是代码:
NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PreferenceBundles/MobilePhoneSettings.bundle"];
BOOL success = [b load];
if (success)
{
NSLog(@"\n\n\n\n Bundle load successfull! \n\n\n\n ");
Class PhoneSettingsCallWaitingController = NSClassFromString(@"PhoneSettingsCallWaitingController");
id tc = [[PhoneSettingsCallWaitingController alloc] init];
[tc setCallWaitingEnabled:0 specifier:0];
} else NSLog(@"\n\n\n\n Bundle load failure! \n\n\n\n ");
我不知道我是否在正确的道路上。还有其他方法可以打开/关闭呼叫等待设置吗?