2011-11-17 61 views
1

它显示我警告initWithDocPath没有找到时,我想私有目录内容..initWithDocPath没有找到

+ (NSMutableArray *)loadScaryBugDocs { 
     NSString *documentsDirectory = [VideoDatabase getPrivateDocsDir]; 
NSError *error; 
NSArray *files =[NSFileManagerdefaultManager]contentsOfDirectoryAtPath:documentsDirectory error:&error]; 
if (files == nil) { 
    return nil; 
} 
NSMutableArray *retval = [NSMutableArray arrayWithCapacity:files.count]; 
for (NSString *file in files) { 
    if ([file.pathExtension compare:@"scarybug" options:NSCaseInsensitiveSearch] == NSOrderedSame) { 
     NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:file]; 
     VideoNotepadViewController *doc = [[[VideoNotepadViewController alloc] initWithDocPath:fullPath] autorelease]; 
//shows warning here 
     [retval addObject:doc]; 
    } 
} 

return retval; 

} 
+0

loadScaryBugDocs'的一部分是什么类?你的'VideoNotepadViewController'是否在'@interface'中声明了'initWithDocPath:'方法? –

+0

loadScaryBugDocs是videoDatabase类的一部分,initWithDocPath没有在该类中声明,因为我认为它不需要cos工作正常,没有声明该方法.... –

+0

'VideoNotepadViewController'实际上是否有一个名为'initWithDocPath:'的方法?这个警告究竟说了什么? –

回答

1

您需要实现initWithDocPath:方法VideoNotepadViewController。 Apple没有提供这个名字的方法。

+0

该方法的返回类型是什么? –

+0

您可以将返回类型设置为'id'或'VideoNotepadViewController *'。 –

+0

其工作很好,谢谢你们.. –