ios - 设置解析查询的缓存策略会导致应用程序崩溃

标签 ios swift parse-platform

我正在使用网站上最新版本的 Parse 在 Swift 中进行开发。我尝试将缓存策略设置为 NetworkElseCache 值,如下所示:

let userRelation = User.currentUser()?.relationForKey("friends")
let userQuery = userRelation!.query()
userQuery.cachePolicy = .NetworkElseCache
userQuery.findObjectsInBackgroundWithBlock {
    (users, error) -> Void in
    print("Success")
}

错误发生在行上:

userQuery.cachePolicy = .NetworkElseCache

如果删除该行,应用程序运行正常,产生的错误是:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Method not allowed when Pinning is enabled.'

我真的不知道接下来要做什么,我大约一周前才开始使用 Parse 和 Swift 进行 iOS 开发,所以我有点迷茫。我也不理解调用堆栈,也不理解它如何帮助我找到我的问题。

最佳答案

在 AppDelegate.m 中禁用 LocalDataStore

所以评论下面的行

Parse.enableLocalDatastore()          // Comment this line and try 

关于ios - 设置解析查询的缓存策略会导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34864938/

相关文章:

ios - 正在主线程上执行长时间运行的 Parse 操作

android - 错误 : no results found for query

ios - 获取 UITabBarItem 图像的默认未选定 TintColor

ios - 在 UITableView 中播放视频

ios - 清理构建在 xcode 9 上失败

ios - 在 Controller Swift 之间传递对象

javascript - 检索和存储 Paypal 订阅

ios - ZBar SDK没有提示音

ios - Alamofire 分段上传出现错误

ios - 将新项目 append 到 Swift 2.0 中的类数组