iphone - iOS 中的当前和更新时间?

标签 iphone xcode ios time

我正在开发一种汽车驾驶工具,它可以保存 GPS 数据、加速度计数据和时间供以后使用。

不过,加速是最不重要的。

我只需要一个小代码示例,这样我就可以在 Xcode 中将当前系统时间打印为更新时钟,因为我希望它尽可能快和尽可能频繁地保存我的数据:>

提前感谢任何答案:)

h4wkeye

最佳答案

获取当前系统时间使用

NSDate* currentDate = [NSDate 日期];

并获取 NSDate 的字符串表示

- (NSString *)description

然后在下面使用

NSString* dateInString = [currentDate description];

关于iphone - iOS 中的当前和更新时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5633896/

相关文章:

ios - 无法将 PrototypeCell 添加到 xib 文件中的 UITableView

ios - 织物/Crashlytics : 'ANSCompatibility.h' file not found

ios - 同一个方案,为什么faSTLane xcov的代码覆盖率值和Xcode的值不一样?

iphone - 给pdf添加注释

ios - 将来自服务器的 UTC 日期存储在 NSDate 对象中

iphone - 一旦拥有 TableView 被推送到 UIViewController 的 subview 上,UITableViewController 不会自动使用键盘滚动

iphone - retain setter 是如何用@synthesize 实现的?

iphone - 使用 searchBar 搜索单词的首字母

iphone - 如何存储和比较时间数据对象

ios - 参数键有方括号 Alamofire iOS