模拟器中的iPhone目录

时间:2011-03-02 17:26:41

标签: iphone objective-c

我正在玩这个代码,它在iPhone模拟器中不起作用。

-(NSString *)localFilePath:(BOOL)forSave {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *documentsPath = [documentsDirectory stringByAppendingPathComponent:@"msaas.config.xml"];
    if (forSave || [[NSFileManager defaultManager] fileExistsAtPath:documentsPath]) {
        return documentsPath;
    }
    else {
        return [[NSBundle mainBundle] pathForResource:@"msaas.config" ofType:@"xml"];
    }
}

是因为模拟器没有像iPhone这样的目录吗?

0 个答案:

没有答案