【发布时间】:2015-06-29 20:28:46
【问题描述】:
我正在尝试从 Parse 数据库中检索查询;但是,当我运行应用程序并单击按钮转到将从数据库中检索数据的视图控制器时,我的应用程序崩溃了。当应用程序崩溃时,我会收到 AppDelegate.swift 文件。
这是错误:由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“启用固定时不允许方法。”
我确保在我的项目中正确实施 Parse。此外,当我取出 if self.objects.count == 0 {} 代码块时,当我转到从数据库中检索数据的视图控制器时,应用程序运行良好。但只有这一次,当我的解析数据库中有对象时,我的 tableview 列表中没有对象。提前致谢。
override func queryForTable() -> PFQuery {
let query = PFUser.query()
if searchInProgress {
// We are looking for the string contents in the search bar to match the names in the parse username category.
query?.whereKey("username", containsString: searchString)
}
// From the objects aleady loaded...
if self.objects?.count == 0{
// If we have not already loaded the elements from our database, then it will use the elements that have already been downloaded when we have already run the app
query?.cachePolicy = PFCachePolicy.CacheThenNetwork
}
query?.orderByAscending("username")
return query!
}
【问题讨论】:
标签: ios swift parse-platform ios8 xcode6