Can't find applicationSupportDirectory?
Posted
by Frost Li
on Stack Overflow
See other posts from Stack Overflow
or by Frost Li
Published on 2010-06-15T22:26:06Z
Indexed on
2010/06/15
22:32 UTC
Read the original article
Hit count: 424
There is always a pre-written function at AppDelegate:
(NSString *)applicationSupportDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory();
return [basePath stringByAppendingPathComponent:@"SyncFile"];
}
However, I can't call this method outside this class:
id _appDelegate = (SyncFile_AppDelegate *)[[NSApplication sharedApplication] delegate];
NSLog(@"%@", [_appDelegate applicationSupportDirectory]);
The compiler warned me that it can't find method applicationSupportDirectory... Does anyone know what's wrong with my code? Thank you very much!
© Stack Overflow or respective owner