我是 Objective-C 的新手,我正在尝试插入 NSdate,但我不知道要包含哪个库才能调用它。我尝试了以下但没有成功。谢谢你的帮助
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#include <CoreFoundation/CoreFoundation.h>
// Get current datetime
NSDate *currentDateTime = [NSDate date];
// Instantiate a NSDateFormatter
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// Set the dateFormatter format
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
// Get the date time in NSString
NSString *dateInString = [dateFormatter stringFromDate:currentDateTime];
// Release the dateFormatter
[dateFormatter release];