【发布时间】:2012-08-02 03:17:21
【问题描述】:
我正在使用 AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) 来振动手机,但它仅在“设置”>“声音”>“振动”开关打开时才有效。当“设置”>“声音”>“振动”开关关闭可编程性时,如何振动我的手机。我的手机已经越狱了。
谢谢!
【问题讨论】:
标签: iphone objective-c jailbreak
我正在使用 AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) 来振动手机,但它仅在“设置”>“声音”>“振动”开关打开时才有效。当“设置”>“声音”>“振动”开关关闭可编程性时,如何振动我的手机。我的手机已经越狱了。
谢谢!
【问题讨论】:
标签: iphone objective-c jailbreak
需要打开振动选项开关。
您需要编辑 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");
【讨论】: