2016-12-28 9 views
0

parse local stat storeからデータを取得しようとしています。Parse Local Data Storeから情報を取得する

私は次のことを実行しているときにエラーがないので、それがピン留めされていることを前提としています

let contact = PFObject(className: "temp") 
contact["firstName"] = "steve" 
contact["lastName"] = "smith" 
contact["email"] = "[email protected]" 
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) 
      } 
    } 
} 

このエラーを返します:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Method requires Pinning enabled.'

私は

の通話場所についてオンラインで少しお読みになりましたアプリデリゲートで
Parse.enableLocalDatastore() 

が、私はどんな結果を生むことができていないと、このテンプレートが解析から直接dlであっ、これは私のアプリデリゲートの最初の部分である:

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) 

答えて

0

ソート.. ..

Parse.enableLocalDatastore() 

私はどこかから得たレガシーアイテムのようです。

単に追加:

ParseMutableClientConfiguration.isLocalDatastoreEnabled = true 
を問題を修正し

あなたが

Parse.enableLocalDatastore() 
のすべてのインスタンスを削除するかコメントアウトする必要があります

関連する問題