views:

27

answers:

1

I'm trying to add a category to AVAudioPlayer but I keep getting the error "Cannot find interface declaration for 'AVAudioPlayer'".

AVAudioPlayer+Fade.h

#import <AVFoundation/AVFoundation.h>

@interface AVAudioPlayer (Fade)

- (void)fadeToVolume:(CGFloat)volume;

@end

AVAudioPlayer+Fade.m

@implementation AVAudioPlayer (Fade)

- (void)fadeToVolume:(CGFloat)volume
{
}

@end

I'm using an AVAudioPlayer in my MainMenuViewController class, so I added:

#import <AVFoundation/AVFoundation.h>

to MainMenuViewController.h

and I added:

#import "AVAudioPlayer+Fade.h"

to MainMenuViewController.m.

The AVFoundation is added to the project. I can use the AVAudioPlayer perfectly without the Fade category. When I add the Fade category, I get that error. Any ideas?

+2  A: 

I think the issue is that you need to add #import "AVAudioPlayer+Fade.h" to AVAudioPlayer+Fade.m.

Cory Kilger
That was the problem, thanks!
Rits