Question

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?

Was it helpful?

Solution

You've probably forgotten to import the AVFoundation headers.

#import <AVFoundation/AVFoundation.h>

OTHER TIPS

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>

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top