簡體   English   中英

無法從本地解析數據庫獲取圖釘對象

[英]Can't get pin object from local parse database

我正在為我的iOS應用程序使用parse,它工作正常。

我想實現離線功能,因此我正在使用pinInBackgroundPFObject保存到本地數據庫。 但是我找不到它。

由於特殊原因,我為每個PFObject引腳名稱生成了唯一的UUID並使用了它。

{

...

    NSString *uuid = [[NSUUID UUID] UUIDString];
    [CustomObject pinInBackgroundWithName:uuID];
...

}

它返回成功,但我無法檢索到它。

以下是獲取pin Object的查詢代碼。

{

...

    PFQuery *query = [CustomObject query];
    [query fromLocalDatastore];
    [query fromPinWithName:uuID];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
     {
         if(!error)
             block(objects, nil);
         else
             block(nil, error);
     }];
...

}

但是對象始終具有0個元素。

任何幫助將不勝感激。

謝謝

更新:

這是保存在解析本地數據庫中的Pin對象。

{"isDeletingEventually":0,"className":"_Pin","__complete":true,"__operations":[{"_name":"16F31F2C-6375-4107-A0B6-FDCBA9810847","__updatedAt":{"__type":"Date","iso":"2017-07-02T18:33:02.825Z"},"_objects":[{"__type":"OfflineObject","uuid":"FF3D069C-864F-4D87-9511-F2738A5F95F4"}],"__uuid":"71BAF309-58D4-4BCC-82D8-BB35C25F1632"}]}

問題是查詢本地數據庫。

我已經改變了這樣的查詢,它為我工作。

{

...
PFQuery *query = [[[CustomObject query] fromLocalDatastore]ignoreACLs];
[query fromLocalDatastore];
[query fromPinWithName:uuID];
...

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM