Trigger methods to logout user when user deletes app - iPad app

后端 未结 2 1682
轮回少年
轮回少年 2021-01-22 17:25

I have an app in which I have implemented login, logout and some customized actions. There are certain actions that can be performed only when user is logged in but if the user

2条回答
  •  终归单人心
    2021-01-22 18:17

    There is no way to know when a user has deleted their app. You can use NSUserDefaults to store their login name once they're logged in and check for it's existence when you attempt to use services they have to be logged in to use. If the app has been deleted and reinstalled (or a new install) the NSUserDefaults value will be nil, if they're an established user it will be equal to their username.

    [[NSUserDefaults standardUserDefaults] setObject:@"the_user_name" forKey:@"kUsername"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    

提交回复
热议问题