1

我正在使用 AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) 来振动手机,但它仅在“设置”>“声音”>“振动”开关打开时才有效。当“设置”>“声音”>“振动”开关关闭可编程性时,如何振动我的手机。我的手机越狱了。

谢谢!

4

1 回答 1

1

需要打开振动选项开关。

您将需要编辑com.apple.springboard.plist

NSString *sbPath = @"/var/mobile/Library/Preferences/com.apple.springboard.plist";

NSMutableDictionary *sbDict = [[NSMutableDictionary alloc] initWithContentsOfFile:sbPath];

[sbDict setValue:[NSNumber numberWithBool:YES] forKey:@"ring-vibrate"];
[sbDict setValue:[NSNumber numberWithBool:YES] forKey:@"silent-vibrate"];
[sbDict writeToFile:sbPath atomically:YES];

/* Check to make sure the settings took */
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);

您还可以发送通知以更新首选项。我不确定这是否仍然有效。

notify_post("com.apple.SpringBoard/Prefs");
于 2012-08-02T04:42:54.207 回答