Cocoa-4.6播放一点声音后启动计时器

Cocoa-4.6播放一点声音后启动计时器,cocoa,audio,timer,Cocoa,Audio,Timer,在我播放完一个声音后,我需要启动一个计时器,有人能帮我吗?我已经写了一个声音和时间同时运行的小代码 CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef soundFileURLRef; soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"song", CFSTR ("wav"), NULL); UInt32 so

在我播放完一个声音后,我需要启动一个计时器,有人能帮我吗?我已经写了一个声音和时间同时运行的小代码

    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"song", CFSTR ("wav"), NULL);
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
    AudioServicesPlayAlertSound(soundID);



    [sender setTitle:@"RUNNIG 2P" forState:UIControlStateNormal];
    milliSecTimer1 =[NSTimer scheduledTimerWithTimeInterval:0.1
                                                     target:self
                                                   selector:@selector(countUp1)
                                                   userInfo:nil
                                                    repeats:YES];

声音的持续时间通常不为零。你的意思是在启动声音时启动计时器,还是在声音结束时启动计时器?顺便说一句,你在代码中泄露了URL和声音ID。