Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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 从解析本地数据存储中检索信息_Ios_Swift_Parse Platform_Parse Server - Fatal编程技术网

Ios 从解析本地数据存储中检索信息

Ios 从解析本地数据存储中检索信息,ios,swift,parse-platform,parse-server,Ios,Swift,Parse Platform,Parse Server,我正在尝试从解析本地stat存储中检索数据 我假设它是固定的,因为运行以下操作时没有错误: let contact = PFObject(className: "temp") contact["firstName"] = "steve" contact["lastName"] = "smith" contact["email"] = "steve.smith@example.com" contact.pinInBackground() 尝试检索时出错: let query = PFQuery(

我正在尝试从解析本地stat存储中检索数据

我假设它是固定的,因为运行以下操作时没有错误:

let contact = PFObject(className: "temp")
contact["firstName"] = "steve"
contact["lastName"] = "smith"
contact["email"] = "steve.smith@example.com"
contact.pinInBackground()
尝试检索时出错:

let query = PFQuery(className: "temp")
query.whereKey("firstName", equalTo: "steve")
query.fromLocalDatastore()

query.findObjectsInBackground { (object, error) in

     if error == nil {
          for object in object! {
               print(object["firstName"] as! String)
          }
     }
}
返回此错误:

由于未捕获异常而终止应用程序 'NSInternalInconsistencyException',原因:'方法需要固定 启用。”

我在网上读到了一些关于

Parse.enableLocalDatastore()
Parse.enableLocalDatastore()
在app delegate中,但我无法生成任何结果,此模板是直接从parse生成的,这是我的app delegate的第一部分:

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


//--------------------------------------
// MARK: - UIApplicationDelegate
//--------------------------------------

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Enable storing and querying data from Local Datastore.
    // Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.

    Parse.enableLocalDatastore()

    let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
        ParseMutableClientConfiguration.applicationId = "XXX"
        ParseMutableClientConfiguration.clientKey = "XXX"
        ParseMutableClientConfiguration.server = "XXX"

    })

    Parse.initialize(with: parseConfiguration)
分类

 Parse.enableLocalDatastore()
似乎是我从某处得到的遗产

只需添加:

ParseMutableClientConfiguration.isLocalDatastoreEnabled = true
解决了这个问题

您需要删除或注释掉的所有实例