Skip to content

Sometimes not returning value #2269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mkaya93 opened this issue Jul 13, 2016 · 10 comments
Closed

Sometimes not returning value #2269

mkaya93 opened this issue Jul 13, 2016 · 10 comments

Comments

@mkaya93
Copy link

mkaya93 commented Jul 13, 2016

Hi,

I'm using parse but I have a problem with parse with ios.

Sometimes I can't get values from parse server. It's not giving error and not returning a value.

@Abderezai
Copy link

Please describe how your requesting data. Show your query, or cloud function call. And if cloud function also show our code in that function.

@hramos
Copy link
Contributor

hramos commented Jul 13, 2016

We are closing this issue due to a lack of sufficient information.

Please refer to this issue for an example of a great bug report.

You may use Server Fault for questions about managing Parse Server.

For code-level and/or implementation-related questions or technical support, please refer to Stack Overflow.

@hramos hramos closed this as completed Jul 13, 2016
@mkaya93
Copy link
Author

mkaya93 commented Jul 13, 2016

let query = PFQuery(className: "Group")
        query.orderByDescending("updatedAt")
        query.whereKey("members", equalTo: PFUser.currentUser()!)


        query.findObjectsInBackgroundWithBlock { (groups, error) in
            if error == nil {
                if groups?.count == 0 {
                    self.isEmpty = true
                    //self.tableView.hidden = true
                    self.emptyView.frame = CGRectMake(0, 130, self.view.frame.size.width, self.emptyView.frame.size.height)
                    self.emptyView.backgroundColor = UIColor(hex: "F5F9FC")
                    self.view.addSubview(self.emptyView)
                    self.emptyView.titleLabel.text = "dontbelonggroup".localized()
                    self.emptyView.createNewGroupButton.setTitle("emptyViewButton".localized(), forState: .Normal)
                    self.emptyView.createNewGroupButton.addTarget(self, action: #selector(self.createNewGroup(_:)), forControlEvents: .TouchUpInside)
                }else {
                    self.groups = groups!
                    self.isEmpty = false
                    self.emptyView.removeFromSuperview()
                }

                self.tableView.reloadData()
            }else {
                print(error)
            }
            self.refreshController.endRefreshing()
            self.loading.hideActivityIndicatorWithAnimation(self.view)

        }

@Abderezai that's my code. Weird part of this issue is its only returning null on apps load. When I trigger it second time its returning with objects.

@Abderezai
Copy link

I am guessing that you have ACL restrictions on the object that you are reading, and the session token is yet not initialized properly on app load. Do you do this in parallel to the app load?

@mkaya93
Copy link
Author

mkaya93 commented Jul 13, 2016

@Abderezai actually I check the acl for this class and its public write + read also I'm initializing it after viewdidload

@Abderezai
Copy link

check ACL for that object, the class level permissions and the acl are not the same.
Also if you can not call query after viewdidload, and hook it up to a button, then see if same issue is still happening. Also maybe remove Parse Server URL so you connect to parse.com and see if the same issue is hapening there?

@mkaya93
Copy link
Author

mkaya93 commented Jul 18, 2016

I checked acl and its "public write and read" also I changed my database and location but still I am getting this.

Also @hramos a few people getting this error too.So I think its a bug.

@mkaya93
Copy link
Author

mkaya93 commented Jul 18, 2016

problem is happening cause of this line

query.whereKey("members", equalTo: currentUser!)

which is shown by @hramos at this link.

https://parse.com/questions/how-do-i-query-using-pfrelation-when-i-just-have-pfuser

I used this like you said but I can't getting objects sometime.

@hramos
Copy link
Contributor

hramos commented Jul 18, 2016

That answer of mine is well over two years old, but the concept remains the same. I highly recommend that you move this over to Stack Overflow as that is a better fit for this kind of Q&A.

@mkaya93
Copy link
Author

mkaya93 commented Jul 18, 2016

I already did but I couldn't get the answer.I'm just trying to findobjects which is currentUser already member and I can't. I checked internet because of this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants