1

I am trying to query a PFObject that contains an array. I am looking to match a given NSString against any object within the PFObject's array of strings. According to http://blog.parse.com/2012/03/28/parse-supports-many-to-many-relations/, I can use whereKey:equalTo to look for matches within an array.

I have replaced the variable I would usually use with the string that I know to be in the array whose object I am querying. It is a character-for-character match. Yet the query returns no matches.

My code:

PFQuery *convosQuery = [PFQuery queryWithClassName:@"convo"];
PFObject *currentUserFacebookID = [NSString stringWithFormat:@"11808098"];
[convosQuery whereKey:@"nonUserFacebookIDs" equalTo:currentUserFacebookID];
[convosQuery findObjectsInBackgroundWithBlock:^(NSArray *convos, NSError *error) {
    for (PFObject *convo in convos) {
        NSLog(@"user/convo match found");

As I said, this returns no matches even though a PFObject of class "convo" contains for key "nonUserFacebookIDs" the value "[["11808098"]]".

What could be going on?

2 Answers 2

2

Does this object have any ACLs that might be restricting reads to a subset of users?

Sign up to request clarification or add additional context in comments.

3 Comments

I have not messed with ACL. The ACL for the object that should be found reads: {"*":{"read":true},"3rkf7hoxrD":{"write":true,"read":true}}
so as far as you can tell, this query for a string contained as an item in an array should work?
Yes. If you contact us through parse.com/help, we can debug further. Make sure to submit the support request using the "Contact us privately" link and mention this post.
1

You mentioned "[["11808098"]]". Does this mean an array of array containing a string? If so, it would not match the string you specified.

And BTW, though not related to your question, why did use the below line? Why should you assign a string to a PFObject?

PFObject *currentUserFacebookID = [NSString stringWithFormat:@"11808098"];

~ Sunil Phani Manne

3 Comments

Hi, thanks for your response. This was a long time ago when I was new to this, and I have no idea why I was assigning a string to a PFObject. And I see what you mean--that does look like an array of arrays, which doesn't make sense.
Hey, if you're knowledgable about Parse, you could maybe take a look at my new question: stackoverflow.com/questions/18519195/… . Cheers
When I click the above link, it says "The question was voluntarily removed by the user!".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.