문제

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?

도움이 되었습니까?

해결책

You've probably forgotten to import the AVFoundation headers.

#import <AVFoundation/AVFoundation.h>

다른 팁

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

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