【问题标题】:iOS Parse and Obj-c: PFKeychainStore failed to set object for key 'currentUser'iOS Parse 和 Obj-c:PFKeychainStore 未能为键“currentUser”设置对象
【发布时间】:2017-02-06 09:46:28
【问题描述】:

在应用程序执行期间,我有时会收到此错误:

PFKeychainStore failed to set object for key 'currentUser', with error: -34018

它并不总是发生,只是有时。 例如,我在 viewDidLoad 中运行这段代码

NSLog(@"%@", [PFUser currentUser]);

if ([ManageConnection isWiFi] || [ManageConnection isFastConnection]) {
    [[PFUser currentUser] fetchInBackgroundWithBlock:^(PFObject * _Nullable object, NSError * _Nullable error) {
        if (error != nil) {
            [ParseErrorHandlingController handleParseError:error];
        }
        else {
            self.user = (PFUser *)object;

当我在控制台 [PFUser currentUser] 值上打印时,它存在

<PFUser: 0x6080000e8980, objectId: 5ZgXxNrT5C, localId: (null)>

但是当我尝试获取用户时,我得到了上面的错误。有什么建议吗?

我正在使用最新版本的 Parse。

【问题讨论】:

  • 嗨朱塞佩,我在这里有点困惑。您可以通过 [PFUser currentUser] 获取当前用户,然后为什么需要在后台再次获取它?
  • 嗨@SatishMavani,你知道我不是代码的所有者,只是修复了一些错误。之前的开发者写了这个函数。反正我经常遇到这个错误。
  • @SatishMavani 我发现了为什么会有那个“获取”。在 viewDidLoad,我需要一个 [PFUser currentUser] 对象的值。由于该值可能会更改,因此我必须更新我的 [PFUser currentUser] 对象。

标签: ios objective-c xcode parse-platform


【解决方案1】:

要更新当前用户,您只能使用以下代码:

[[PFUser currentUser] fetch];

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。这是关于 iOS10 中的代码设计。检查您的配置文件,然后再次尝试安装。

    【讨论】:

      猜你喜欢
      • 2020-09-27
      • 2020-05-04
      • 2019-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多