문제

What's wrong with this code? I've used it before but now I'm getting these warnings...

warning: passing argument 2 of 'AudioServicesCreateSystemSoundID' from incompatible pointer type

warning: passing argument 1 of 'AudioServicesPlaySystemSound' makes integer from pointer without a cast

-(void)playfireSound{

    NSString *path = [[NSBundle mainBundle] pathForResource:@"fireSound" ofType:@"wav"];
    NSURL *url = [NSURL fileURLWithPath:path];
    AudioServicesCreateSystemSoundID((CFURLRef) url, &fireSound);   
    AudioServicesPlaySystemSound(fireSound);
}
도움이 되었습니까?

해결책

Your declaration of your fireSound variable is probably incorrect for use with this API. Maybe you declared it as an object of some sort, instead of as an SystemSoundID, which is of type int.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top