【问题标题】:Crashing on addObject/removeObject with PFRelation after migrating to heroku迁移到 Heroku 后使用 PFRelation 在 addObject/removeObject 上崩溃
【发布时间】:2016-09-06 17:52:20
【问题描述】:

迁移到 heroku 后,我的代码在将 PFUser 添加到 PFRelation 时崩溃。当托管在 Parse 上时,此代码运行良好。

func blockUser(user : PFUser) -> Void {
    PFUser.currentUser()?.relationForKey("blocked").addObject(user)
    PFUser.currentUser()?.saveInBackground()
}

现在结果:

2016-05-11 06:51:39.480 APP[69960:7963868] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Operation is invalid after previous operation.'

我在 mongo 上的架构看起来不错,但也许不是?

{
    "_id": "_User",
    "_metadata": {
        "class_permissions": {
            "get": {
                "*": true
            },
            "find": {
                "*": true
            },
            "update": {
                "*": true
            },
            "create": {
                "*": true
            },
            "delete": {
                "*": true
            },
            "addField": {
                "*": true
            },
            "readUserFields": [],
            "writeUserFields": []
        },
        "auth_options": {
            "anonymous": {
                "enabled": false
            },
            "_enable_by_default": false,
            "username": {
                "enabled": true
            },
            "facebook": {
                "enabled": false
            },
            "twitter": {
                "enabled": false
            }
        }
    },
    "emailVerified": "boolean",
    "username": "string",
    "email": "string",
    "dateOfBirth": "date",
    "location": "geopoint",
    "blocked": "relation<_User>",
    "showAge": "boolean"
}

调用栈:

*** First throw call stack:
(
    0   CoreFoundation                      0x000000010d4d4d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010cf48deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010d4d4cbd +[NSException raise:format:] + 205
    3   Parse                               0x000000010b113f07 -[PFRelationOperation applyToValue:forKey:] + 951
    4   Parse                               0x000000010b16bef6 +[PFObjectUtilities newValueByApplyingFieldOperation:toDictionary:forKey:] + 166
    5   Parse                               0x000000010b161f19 -[PFObjectEstimatedData applyFieldOperation:forKey:] + 121
    6   Parse                               0x000000010b149759 -[PFObject(Private) performOperation:forKey:] + 153
    7   Parse                               0x000000010b1ba442 __24-[PFRelation addObject:]_block_invoke_2 + 290
    8   Parse                               0x000000010b1ba292 __24-[PFRelation addObject:]_block_invoke + 146
    9   libdispatch.dylib                   0x000000010e61c3eb _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x000000010e600ef5 _dispatch_barrier_sync_f_invoke + 393
    11  Parse                               0x000000010b1ba13e -[PFRelation addObject:] + 270
    12  APP                                 0x000000010a273eb4 _TFC8APP21ProfileViewController9blockUserfCSo6PFUserT_ + 1380

【问题讨论】:

    标签: ios mongodb heroku parse-platform pfrelation


    【解决方案1】:

    我不确定以下两个操作中的哪一个(或两个)解决了我的问题,但我在尝试从 PFRelation 添加/删除某些内容时不再崩溃:

    1. 删除所有安装
    2. 删除所有会话

    【讨论】:

      猜你喜欢
      • 2016-06-11
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 2015-02-04
      • 2019-09-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多