NSValue 可能无法响应...警告
我在 XCode 中收到一条警告,显示 NSValue may not respond to +valueWithCMTime:'
但我不确定我做错了什么。在我的头文件中,我有这个:
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
...
-(void)displayTime:(CMTime)time;
在我的实现文件中,我有这个:
-(void)displayTime:(CMTime)time
{
//This line has the warning
[mutableArray addObject:[NSValue valueWithCMTime:time]];
}
我在另一个类的其他地方使用了上面的行,并且没有警告,那么这个类中可能缺少什么?这与方法的设置方式有关吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能忘记导入 AVFoundation 标头。
You've probably forgotten to import the AVFoundation headers.
iPhone 类
NSValue
没有valueWithCMTime
。查看在线文档< /a>
它是由 AVFoundation 框架添加的,如文档所述 此处。
添加了相应的标头包含:
The iPhone class
NSValue
has novalueWithCMTime
.Check out the online documentation
It is added by AVFoundation framework, as documented here.
Added the corresponding header inclusion :
制作一个 NSMutableArray...因为你需要一个 NSValue
Make an NSMutableArray.... because you need an NSValue