Rits
Rits

Reputation: 5175

Cannot add category to AVAudioPlayer

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?

Upvotes: 1

Views: 321

Answers (1)

Cory Kilger
Cory Kilger

Reputation: 13044

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

Upvotes: 2

Related Questions