iOS获取应用当前Caches目录路径以及当前日期

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *path = [[paths objectAtIndex:0] stringByAppendingString:@"/hi.dat"];
    
    [[NSFileManager defaultManager] createFileAtPath:path contents:NULL attributes:NULL];
    
    NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
    NSLog(@"URL is: %@", url);
    [url release];

    NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0.0];
    // 打印日期:中间的空格可以用‘at‘或‘T‘等字符来分隔
    NSDateFormatter *dateFomatter = [[NSDateFormatter alloc] init];
    [dateFomatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSLog(@"Current date is: %@", [dateFomatter stringFromDate:date]);
    [dateFomatter release];

iOS获取应用当前Caches目录路径以及当前日期,布布扣,bubuko.com

iOS获取应用当前Caches目录路径以及当前日期

上一篇:Android 再多图片也不会出现OOM


下一篇:S3C2440的SPI解析