我有以下代码:
(void)loadStateChanged:(NSNotification*)notification
{
if ([[movie attributeForKey:QTMovieLoadStateAttribute] longValue] >= kMovieLoadStatePlayable)
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
long movieScale = [[movie attributeForKey:QTMovieTimeScaleAttribute] longValue];
[movie setCurrentTime:QTMakeTime(0, movieScale)];
[movie play];
}
并且它抛出了这个错误:
错误:'kMovieLoadStatePlayable'未声明(首次在此函数中使用)
我相信kMovieLoadStatePlayable属于QuickTime框架,我的程序中有QTKit和QuickTime框架,但我无法弄清楚为什么它在这里出错。我知道这与这些框架有关。
答案 0 :(得分:2)
源文件中是否有#import,您在其中使用此符号?
将框架拖到项目中并不会使其标头可用于每个源文件(这会显着降低编译速度)。您必须为每个源文件使用的每个框架明确包含伞标题。
如果您确信在每个源文件中都使用框架,那么将#import添加到您的前缀标题中。