내 비틀기의 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>
하지만 내 코드를 사용하는 방법을 모르겠어요.
감사합니다. 그냥 클래스를 가져,
이그냥 장치가 진동을하게하는 함수를 작성하고 당신은 당신이 말한 같은 일을 할 필요가 함께 IBOutlet
ViewController.h
-(IBAction)Vibrate;
ViewController.m
#import "ViewController.h"
#import "AudioToolbox/AudioToolbox.h"
@implementation ViewController
-(IBAction)Vibrate
{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
하지만 iPhone을 진동시킬 때 사용합니까? 내가 토글을 활성화 할 때 그것을 원한다 – SUPERGIU