我正在使用AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)来振动手机,但它仅在设置>时才有效。声音>振动开关打开。设置>时,如何振动手机?声音>振动开关关闭可编程性。我的手机越狱了。
谢谢!
答案 0 :(得分: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");