gpt4 book ai didi

ios - QuickBlox IOS session 过期更新

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:08:53 24 4
gpt4 key购买 nike

这个问题有多个方面,涉及具有登录名的应用程序,以及即时消息,即 QBChat。所有这些问题都有些关联。

1) 当用户登录时,我创建一个 session ,将 QBUser 登录,然后将 QBUSer 登录到 QBChat。通常的做法是,当用户注销以注销 QBChat、注销 QBUser 并销毁 session 时?

2) 目前,当应用程序被发送到后台时,我将用户从 QBChat、QBUSER 中注销并销毁他们的 session ,当用户回来时我创建一个新 session 并将他们重新登录到所有内容。我这样做是为了确保当应用程序处于后台时用户 session 不会过期。有没有其他方法可以在应用程序使用时自动更新 session ?

3) 最后,这个问题又回到了第二个问题,如果我正在使用应用程序并且 session 过期,是否有回调函数在 session 过期时被调用?因此,如果我连续使用该应用程序 2 小时,并且 session 已过期,我是否可以获得它已过期的指示并手动续订或自动完成?

最佳答案

1) When a user logs in, I create a session, login the QBUser in, and log in the QBUSer to QBChat. Is is common practice, when a user logs out to log out of QBChat, log out of QBUser and destroy the session?

是的,这是常见的模式。您需要知道的两件事:

2) Currently, when the application is sent to the background, I log the user out of QBChat, QBUSER and destroy their session and when the user comes back I create a new session and log them back in to everything. I do this to make sure that the users session doesn't expire when while the application is in the background. Is there any other way to automatically renew sessions when the application is in use?

3) Finally, this question relates back to the second one, if I am using the application and the session expires, is there a call back function that will be called if the session expires? So if I use the application for 2 hours straight, and the session expires is there anyway I can get a indication that it expired and either manually renew it or have it done automatically?

我只做 QBChat 注销。您不需要每次都销毁 session 。如果需要,您可以重新创建 session 而无需先销毁它。要检查 session 到期日期时间使用

NSDate *sessionExpiratioDate = [QBBaseModule sharedModule].tokenExpirationDate;

关于ios - QuickBlox IOS session 过期更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20666880/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com