Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 解析本地数据存储:在Swift中取消绑定对象似乎已损坏_Ios_Swift_Parse Platform_Local Datastore - Fatal编程技术网

Ios 解析本地数据存储:在Swift中取消绑定对象似乎已损坏

Ios 解析本地数据存储:在Swift中取消绑定对象似乎已损坏,ios,swift,parse-platform,local-datastore,Ios,Swift,Parse Platform,Local Datastore,我想取消绑定一个对象列表,我之前成功地在本地存储了该列表,并将其替换为一个新列表。下面的代码应该可以做到这一点,但是本地固定的对象不会得到更新。我尝试了一切,包括PFObject.unpin,除了完全重置模拟器外,没有任何东西可以移除旧的固定对象 func updateCountryList(server:Int, local:Int) { let query = VEPCountry.queryAll() query.findObjectsInBackgroundWithBlo

我想取消绑定一个对象列表,我之前成功地在本地存储了该列表,并将其替换为一个新列表。下面的代码应该可以做到这一点,但是本地固定的对象不会得到更新。我尝试了一切,包括PFObject.unpin,除了完全重置模拟器外,没有任何东西可以移除旧的固定对象

func updateCountryList(server:Int, local:Int) {
    let query = VEPCountry.queryAll()
    query.findObjectsInBackgroundWithBlock {
        (objects: [AnyObject]!, error: NSError!) -> Void in
        if error != nil {
            // throw error
        } else {
            if local != 0 {
                VEPState.unpinAllObjectsWithName(String("countryListVersion\(local)"))
            }
            VEPState.pinAll(objects, withName: String("countryListVersion\(server)"))
            defaults.setObject(server, forKey: "localCountryListVersion")
        }
    }
}

感谢您的帮助或指向有关在Swift中取消钉扎的已知问题的指针

我想知道您的取消钉扎是否还没有真正完成,它毕竟会转到数据库

你能试试吗

query
  .findObjectsInBackground()
  .continueWithSuccessBlock({ (task: BFTask!) -> AnyObject! in
    // ...
    return VEPState.unpinAllObjectsWithNameInBackground("name"))
  })
  .continueWithSuccessBlock({ (task: BFTask!) -> AnyObject! in
    // ...
    return VEPState.pinAllInBackground(objects, withName: "name"))
  })

我可能有一些语法错误,背景方法名称不太正确。此外,我正在使用承诺/任务,这不是一个坏习惯。

您使用的是什么版本?解析iOS SDK 1.6.2->最新版本,如果我没有弄错的话。为什么取消钉入和钉入方法的pin名称不同?我在下一组中使用新的pin名称,所以下一次新pin是用于取消钉入的旧pin。不应该有什么不同。我也试过用同一个名字,但问题并没有像你一样消失。Unpin不起作用。我尝试了实例方法和静态方法。它改变不了什么。查询本地存储时,我的对象仍然存在。。。有解决办法吗?