如何获取iOS的App安装时间

2020-08-03  本文已影响0人  Codepgq
  NSURL* urlToDocumentsFolder = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
    __autoreleasing NSError *error;
    NSDate *installDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:urlToDocumentsFolder.path error:&error] objectForKey:NSFileCreationDate];

    NSLog(@"This app was installed by the user on %@ %f", installDate, [installDate timeIntervalSince1970]);
上一篇下一篇

猜你喜欢

热点阅读