【发布时间】:2014-09-20 12:10:01
【问题描述】:
我正在寻找一种在我的调整的 PrefernceBundle 中打开切换开关时添加振动的方法。
这是我的代码的一部分:
#define PLIST_PATH @"/var/mobile/Library/Preferences/MyTweak.plist"
inline bool GetPrefBool(NSString *key)
{
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];
}
%hook Config
- (void)setURL:(NSString *)fp8 {
if(GetPrefBool(@"kPatch")) {
fp8 = @"http://abcdef.com";
%orig(fp8);
}
return %orig;
}
%end
我想当你打开“kPatch”开关时,设备会振动。
我知道我需要使用这个:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
并导入:
#import <AudioToolbox/AudioServices.h>
但我不知道如何在我的代码中使用它们。
谢谢大家!
【问题讨论】:
标签: ios objective-c iphone theos tweak