Search code examples
iosobjective-cparse-platformpfobject

Does not show/retrieve PFObjects that were created by another Parse Installation user


I've been working on an app for months, and in the development stage it was having no problem retrieving info from the Parse backend. However, the second that I moved the app over to distribution and put in on the app store, I discovered that all the objects that someone would send me from their installation would not show up in my inbox. I am only able to see the objects I created in my inbox. Would anyone know possibly why I can't see objects that other users make on my app, and Vise Versa? Btw, this is through Xcode, Objective-C, and iOS.


Solution

  • In the Parse data browser, check the ACL on the objects you expect to see but don't. You are probably creating objects that are not publicly readable. You need to set a publicly readable acl on those objects.

    PFObject *pfObject = [PFObject objectWithClassName:@"MyClass"];
    PFACL *acl = [PFACL ACL];
    [acl setPublicReadAccess:true];
    pfObject.ACL = acl;
    [pfObject saveEventually];
    

    You can also set up a default ACL somewhere in your app, possibly in your AppDelegate.m right after you intialize parse, so you don't need to create an ACL every time you create an object:

    // Connect to Parse
    [Parse setApplicationId:@"app-id" clientKey:@"client-key"];
    
    // Set the default ACL
    PFACL *defaultACL = [PFACL ACL];
    [defaultACL setPublicReadAccess:YES];
    [PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];
    

    If that isn't your issue, post some code as well as the ACL for an object you expect to see but don't.