简体   繁体   English

使用 Xamarin 的 iOS 应用的安装日期

[英]Installed date for an iOS app using Xamarin

有没有办法使用 Xamarin.iOS 查找应用程序安装在设备上的日期?

Why don't you use UserDefaults?为什么不使用 UserDefaults?

You could check for a key let's say "installDate", if it does't exist it means it's the first time your launching the app and you'll set the installDate as the current date.你可以检查一个键,比如“installDate”,如果它不存在,这意味着这是你第一次启动应用程序,你将 installDate 设置为当前日期。 If it does exist you know that the app was launched already.如果它确实存在,您就知道该应用程序已经启动。

I solved it by adding:我通过添加解决了它:

var urlToDocumentsFolder = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User).First();
var creationDate = NSFileManager.DefaultManager.GetAttributes(urlToDocumentsFolder.Path).CreationDate;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM