Ios 每五秒钟发出一次声音循环警报
我试着每五秒钟写一个简单的循环声音警报 请问我怎么加 为cydia调整 Tweak.xm模板Ios 每五秒钟发出一次声音循环警报,ios,objective-c,jailbreak,tweak,Ios,Objective C,Jailbreak,Tweak,我试着每五秒钟写一个简单的循环声音警报 请问我怎么加 为cydia调整 Tweak.xm模板 if (lowenabled) { if ([batString isEqualToString:lowbatPercent_String]) { if (lowplayer) { return; } if (lowsound == 0) soundFilePath = [NSString s
if (lowenabled) {
if ([batString isEqualToString:lowbatPercent_String]) {
if (lowplayer) {
return;
}
if (lowsound == 0)
soundFilePath = [NSString stringWithFormat:@"%@/Super Mario.mp3", bundlePrefix];
else if (lowsound == 1)
soundFilePath = [NSString stringWithFormat:@"%@/Super Mario 1.mp3", bundlePrefix];
soundFileURL = [NSURL fileURLWithPath:soundFilePath];
lowplayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
lowplayer.numberOfLoops = 3;
[lowplayer play];
} else {
if (lowplayer) {
lowplayer = nil;
}
}
}
}
%end
包括点火计时器:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(playSound:) userInfo:nil repeats:YES];
[timer fire];
将方法放在同一类中:
- (void)playSound {
// the code you included here that plays the sound
}
包括点火计时器:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(playSound:) userInfo:nil repeats:YES];
[timer fire];
将方法放在同一类中:
- (void)playSound {
// the code you included here that plays the sound
}
[lowplayer play];-->进入playSound()的注释所在位置。以及您为设置lowplayer所做的所有其他操作,除非您决定在该函数之外设置lowplayer,但它需要在整个视图控制器/类中都可以访问。xm:36:10:警告:未使用的变量“timer”[-Wunused variable]NSTimer*timer=[NSTimer scheduledTimerWithTimeInterval:5.0 tar…^添加[timer fire];在声明计时器以删除该错误后。让我知道这是否有效。agian///.Tweak.xm:45:10:警告:未使用的变量'timer'[-Wunused variable]NSTimer*计时器=[NSTimer scheduledTimerWithTimeInterval:5.0 target:sel…^[lowplayer play];-->进入playSound()中,注释在其中。以及您为设置lowplayer所做的所有其他操作,除非您决定在该函数之外设置lowplayer,但它需要在整个视图控制器/类中都可以访问。xm:36:10:警告:未使用的变量“timer”[-Wunused variable]NSTimer*timer=[NSTimer scheduledTimerWithTimeInterval:5.0 tar…^Add[timer fire];在声明计时器以删除该错误后。让我知道这是否有效。agian///.Tweak.xm:45:10:警告:未使用的变量'timer'[-Wunused variable]NSTimer*计时器=[NSTimer scheduledTimerWithTimeInterval:5.0目标:sel^