简体   繁体   English

更新缓存的PFUser currentUser?

[英]Update cached PFUser currentUser?

When you sign in using Parse, [PFUser currentUser] is cached locally on the device. 使用Parse登录时, [PFUser currentUser]将在本地缓存在设备上。 I have a problem in that some custom data stored in that user's object can be updated outside of the app, so if the user is still logged in calling [PFUser currentUser] will get the cached user object and therefore it won't have the new data. 我有一个问题,即存储在该用户对象中的一些自定义数据可以在应用程序之外更新,因此如果用户仍然登录调用[PFUser currentUser]将获得缓存的用户对象,因此它将没有新的数据。 To update the cached user's object, the user has to sign out and back in. 要更新缓存用户的对象,用户必须注销并重新登录。

How can I update/refetch the current user programmatically without discarding their session? 如何在不丢弃会话的情况下以编程方式更新/重新获取当前用户?

Yes, it did have method to deal with this issue from Parse.com . 是的,它确实有办法从Parse.com处理这个问题。 You can check the category of fetch method like - (BFTask *)fetchInBackground and here is the link for API: https://parse.com/docs/ios/api/Classes/PFObject.html#//api/name/fetchInBackground 您可以检查fetch方法的类别,如- (BFTask *)fetchInBackground ,这里是API的链接: https- (BFTask *)fetchInBackground

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

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