NSValue may not respond to... warning

469 views Asked by At

I'm getting a warning in XCode which says NSValue may not respond to +valueWithCMTime:' but I'm not sure what I'm doing wrong. In my header file, I have this:

#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>

...
-(void)displayTime:(CMTime)time;

and in my implementation file, I have this:

-(void)displayTime:(CMTime)time
{
     //This line has the warning
     [mutableArray addObject:[NSValue valueWithCMTime:time]];
}

I've used the above line elsewhere in another class and there's no warning, so what could be missing from this one? Is it something to do with the way the method is set up?

3

There are 3 answers

1
omz On BEST ANSWER

You've probably forgotten to import the AVFoundation headers.

#import <AVFoundation/AVFoundation.h>
0
Gabriel On

Make an NSMutableArray.... because you need an NSValue

0
Jaffa On

The iPhone class NSValue has no valueWithCMTime.

Check out the online documentation

It is added by AVFoundation framework, as documented here.

Added the corresponding header inclusion :

#import <AVFoundation/AVFoundation.h>