24 小时后 Firebase 停止工作,但如果我更新 pods 它会再次开始工作

After 24 hours Firebase stops working but if I update pods it starts working again

我正在研究 Firebase,我有一个问题。我已经通过 Firebase 登录并触发了插入、更新、删除查询。

这是我的代码:

[self.data observeEventType:FIRDataEventTypeChildAdded withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
        NSArray *array = snapshot.value;
        NSLog(@"%@",array);
    }];

此块工作正常,但每 24 小时后它就会停止调用。但是,如果我更新 pod 然后它再次开始工作。

基于新的 Firebase,没有像旧的那样管理会话的选项,因此如果您的会话过期,您只需调用注销 API:

NSError *error;
[[FIRAuth auth] signOut:&error];
if (!error) {
  // Sign-out succeeded
}

并强制用户再次登录,因此无需再次安装 firebase pod。


如果您是 Firebase 的老用户,请按以下方式管理它:

如果您勾选 Firebase Persisting User Auth State

When a user authenticates, the default session length is 24 hours from initial authentication. This means that the user's authentication state will automatically be persisted between page loads. You can configure the session length by navigating to the Login & Auth section of your Firebase App Dashboard and configuring the Session Length dropdown on the top right. Every auth provider has an optional remember parameter.

所以发给认证用户的Token默认24小时有效。您可以从应用面板上的“登录和授权”选项卡更改此设置。