{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/987","repository_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX","labels_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/987/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/987/comments","events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/987/events","html_url":"https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/987","id":166825295,"number":987,"title":"fetchIfNeededInBackgroundWithBlock : [Error]: Object not found. (Code: 101, Version: 1.14.1)","user":{"login":"burf2000","id":319453,"avatar_url":"https://avatars.githubusercontent.com/u/319453?v=3","gravatar_id":"","url":"https://api.github.com/users/burf2000","html_url":"https://github.com/burf2000","followers_url":"https://api.github.com/users/burf2000/followers","following_url":"https://api.github.com/users/burf2000/following{/other_user}","gists_url":"https://api.github.com/users/burf2000/gists{/gist_id}","starred_url":"https://api.github.com/users/burf2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burf2000/subscriptions","organizations_url":"https://api.github.com/users/burf2000/orgs","repos_url":"https://api.github.com/users/burf2000/repos","events_url":"https://api.github.com/users/burf2000/events{/privacy}","received_events_url":"https://api.github.com/users/burf2000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-07-21T13:55:17Z","updated_at":"2016-07-22T09:15:02Z","closed_at":null,"body":"So I have spent the day trying to track this down.\r\nHistory, moving from Parse to Parse Server (latest version of all)\r\nI have a website that creates a record (**Search**) and attaches a couple of images to it (**SearchPicture**) for which it creates a relationship (**Parse.Object.extend(\"SearchPicture\")**).  \r\n\r\nThis works perfect in Parse.\r\nOn the iOS end, we load up the **Search**, and loop through its relationships to **SearchPictures** and use **fetchIfNeededInBackgroundWithBlock**.\r\n\r\nMoving it to Parse Server, I get  **[Error]: Object not found. (Code: 101, Version: 1.14.1)**, I can see the ID of the record it is trying to find (**gq5h0xddGA**) and I can see the record in Mongo :\r\n\r\n_{ \"_id\" : \"**gq5h0xddGA**\", \"searchPictureImage\" : \"4992d20cad4f3d8c90804efa42f6475a_Screen Shot 2016-07-15 at 13.41.23.png\", \"_created_at\" : ISODate(\"2016-07-21T13:31:18.592Z\"), \"_updated_at\" : ISODate(\"2016-07-21T13:31:18.592Z\") }_\r\n\r\nIf I just query the table normally (**SearchPicture**) in iOS it works fine and  **fetchIfNeededInBackgroundWithBlock** is successful.\r\n\r\nSo it seems to be the link between **Search** and **SearchPicture** that causes **fetchIfNeededInBackgroundWithBlock** to fail\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/comments/234495227","html_url":"https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/987#issuecomment-234495227","issue_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-iOS-OSX/issues/987","id":234495227,"user":{"login":"burf2000","id":319453,"avatar_url":"https://avatars.githubusercontent.com/u/319453?v=3","gravatar_id":"","url":"https://api.github.com/users/burf2000","html_url":"https://github.com/burf2000","followers_url":"https://api.github.com/users/burf2000/followers","following_url":"https://api.github.com/users/burf2000/following{/other_user}","gists_url":"https://api.github.com/users/burf2000/gists{/gist_id}","starred_url":"https://api.github.com/users/burf2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burf2000/subscriptions","organizations_url":"https://api.github.com/users/burf2000/orgs","repos_url":"https://api.github.com/users/burf2000/repos","events_url":"https://api.github.com/users/burf2000/events{/privacy}","received_events_url":"https://api.github.com/users/burf2000/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T09:15:02Z","updated_at":"2016-07-22T09:15:02Z","body":"So more than ever I am convinced this is a bug.  I have re-written the code to actually just get the objectID from the relationship then manually retrieve the record and it works fine.\r\n\r\n**New code**\r\nlet searchPictures : [PFObject] = Search.sharedInstance.selectedPerson[\"searchPictures\"] as! [PFObject]\r\n            \r\n            for searchPicture : PFObject in searchPictures {\r\n\r\n                var query = PFQuery(className:\"SearchPicture\")\r\n                query.getObjectInBackgroundWithId(searchPicture.objectId!) {\r\n                    (searchPicture: PFObject?, error: NSError?) -> Void in\r\n                    if error == nil && searchPicture != nil {\r\n                        \r\n                            let file : PFFile = searchPicture![\"searchPictureImage\"] as! PFFile\r\n                            \r\n                            file.getDataInBackgroundWithBlock({ (data, error) -> Void in\r\n                                \r\n                                if error == nil {\r\n                                    if let image = UIImage(data: data!) {\r\n                                        Search.sharedInstance.missingPersonPhotosArray.append(image)\r\n                                        \r\n                                        if Search.sharedInstance.missingPersonPhotosArray.count > 0 {\r\n                                            // Add 1st image to missing person page\r\n                                            dispatch_async(dispatch_get_main_queue()) {\r\n                                                self.missingPersonMainImage.image = Search.sharedInstance.missingPersonPhotosArray.first\r\n                                                self.spinner.stopAnimating()\r\n                                                self.spinner.hidden = true\r\n                                            }\r\n                                        }\r\n                                    } else {\r\n                                        self.spinner.stopAnimating()\r\n                                        self.spinner.hidden = true\r\n                                    }\r\n                                } else {\r\n                                    self.spinner.stopAnimating()\r\n                                    self.spinner.hidden = true\r\n                                }\r\n                                \r\n                            })\r\n                            \r\n                    } else {\r\n                        self.spinner.stopAnimating()\r\n                        print(error)\r\n                    }\r\n                }\r\n\r\n**Old code**\r\nlet searchPictures : [PFObject] = Search.sharedInstance.selectedPerson[\"searchPictures\"] as! [PFObject]\r\n            \r\n            for searchPicture : PFObject in searchPictures {\r\n\r\n                searchPicture.fetchIfNeededInBackgroundWithBlock({ (Object, error) -> Void in\r\n                    print (error)\r\n                if error == nil {\r\n                    let file : PFFile = searchPicture[\"searchPictureImage\"] as! PFFile\r\n                    \r\n                    file.getDataInBackgroundWithBlock({ (data, error) -> Void in\r\n                        \r\n                        if error == nil {\r\n                            if let image = UIImage(data: data!) {\r\n                                Search.sharedInstance.missingPersonPhotosArray.append(image)\r\n                                \r\n                                if Search.sharedInstance.missingPersonPhotosArray.count > 0 {\r\n                                    // Add 1st image to missing person page\r\n                                    dispatch_async(dispatch_get_main_queue()) {\r\n                                        self.missingPersonMainImage.image = Search.sharedInstance.missingPersonPhotosArray.first\r\n                                        self.spinner.stopAnimating()\r\n                                        self.spinner.hidden = true\r\n                                    }\r\n                                }\r\n                            } else {\r\n                                self.spinner.stopAnimating()\r\n                                self.spinner.hidden = true\r\n                            }\r\n                        } else {\r\n                            self.spinner.stopAnimating()\r\n                            self.spinner.hidden = true\r\n                        }\r\n                        \r\n                    })\r\n                    \r\n                } else {\r\n                    self.spinner.stopAnimating()\r\n                }\r\n                \r\n                })\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"burf2000"}}