1

AVAudioPlayer でサウンド ファイルを再生したいのですが、微調整するとセーフ モードになります。

これが私のコードです:

#import <SpringBoard/SpringBoard.h>
#import <AVFoundation/AVAudioPlayer.h>

%hook SpringBoard

- (void)applicationDidFinishLaunching:(id)application {

NSString *settingsPath = @"/var/mobile/Library/Preferences/com.ziph0n.vibrateonstart.plist";

NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];

BOOL enabled = [[prefs objectForKey:@"enabled"] boolValue];

BOOL sound = [[prefs objectForKey:@"sound"] boolValue];

if (enabled) {

    if (sound) {

    %orig;

    SystemSoundID mBeep;

    NSString* path = [[NSBundle mainBundle] pathForResource:@"beep-beep" ofType:@"caf"];;
    NSURL* url = [NSURL fileURLWithPath:path]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &mBeep);

    AudioServicesPlaySystemSound(mBeep);

    }

  }

}

%end

オーディオ ファイルが Ressources フォルダーにある

4

1 に答える 1