简体   繁体   English

如何确定我的应用是第一次从AppStore下载?

[英]How do I determine that my app was just downloaded from AppStore the first time?

This is how it is accomplished in my app: 这是在我的应用程序中完成的方式:

  • I keep the data in iCloud. 我将数据保存在iCloud中。
  • I need to do some time consuming thing for users who already used my app. 我需要为已经使用我的应用程序的用户做一些耗时的事情。 But this will also start for completely new users... they just downloaded my app from AppStore for the first time. 但这也将针对全新的用户开始……他们是第一次从AppStore下载我的应用。 And this is not expected. 这是不期望的。

How can I determine that the app is running, but downloaded from AppStore for the first time? 如何确定该应用程序正在运行,但是首次从AppStore下载?

What I could do, but I did not: 我可以做什么,但我没有:

  • put any boolean data in the Keychain, and then check if it exists. 将所有布尔数据放入“钥匙串”中,然后检查其是否存在。

Since you have no non-app end to distinguish users Keychain as you mentioned is your only app persistance option that will survive app uninstalling. 由于您没有非应用程序端来区分用户,因此您所说的“钥匙串”是您唯一的应用程序持久性选项,它将在应用程序卸载后继续存在。 Only device Reset to factory settings would remove it. 只有将设备重置为出厂设置才能将其删除。

you can use NSUserDefaults . 您可以使用NSUserDefaults。 if appDelegate.m ->didFinishLaunchingWithOptions use this code : 如果appDelegate.m-> didFinishLaunchingWithOptions使用此代码:

NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
if([userDefaults objectForKey:@"first_time"] == nil){
     [userDefaults setObject:@"1" forKey:@"first_time"];

     //do whatever you need
}

this condition will satisfied only once after installation . 安装后,此条件只能满足一次。

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

相关问题 当我已经从AppStore下载应用程序时,通过我的设备上的xcode运行应用程序 - Running an application through xcode on my device while I already have the app downloaded from the AppStore 如何知道从appstore更新后是否第一个应用启动 - how to know if first app launch after update from appstore 如何确定用户从服务器下载的网页中选择的输入字段 - How do I determine the input field the user has selected from a web page downloaded from a server 如何确定用户第一次运行应用程序? - How to determine that user runs the app for the first time? 我无法将我的应用程序从xcode上传到appstore - I can't upload my app to the appstore from xcode iOS首次启动使链接用户从以下位置下载应用程序 - IOS first time launch get the link user downloaded the app from iOS FCM无法在从AppStore Obj-C下载的应用程序上运行 - iOS FCM not working on downloaded app from AppStore Obj-C 从Appstore下载的应用在9.3版以下设备中崩溃 - App downloaded from appstore crash in 9.3 lower version Devices 如何对AppStore中的更新应用程序版本执行一些操作 - How to do some actions on update app version from AppStore 我怎么知道我的iAd在AppStore中发布后会正常工作? - How do i know my iAd will work after release in AppStore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM