2011-11-17 60 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

其工作很好,謝謝你們.. –