0

This statement worked a few weeks ago and now is giving me a forward declaration error. The error reads "Reciever 'PFQuery' for class message is a forward declaration".

It also says for that same line

PFQuery *query = [PFQuery queryWithClassName:@"storeInfo"];

that no known class method for selector 'queryWithClassName' which is weird because I looked this up on Parse.com's documentation #import Parse/Parse.h which I did in this particular classes'.h file and the following PFQuery statements are the classic way to get an array with the information I need.

I tried looking up forward declaration and got a bit confused. Why am I getting this error?

Can anyone help me, possibly explain forward declaration as opposed to a standard declaration of a class?

This is an iOS Xcode project (Objective-C language) that is importing data from Parse.com. I appreciate any help on this and hints on where to look for answers.

- (NSMutableArray *) allStoreNames {
    NSMutableArray *allStoreNames = [[NSMutableArray alloc] init];
    PFQuery *query = [PFQuery queryWithClassName:@"storeInfo"];
    [query whereKey:@"tag" equalTo:@"artistree"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (error) {
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        } else {
            for (PFObject *parseobject in objects) {
                Store *store = [[Store alloc] initWithPFObject:parseobject];
                NSString *storeString = store.name;
                [allStoreNames addObject:storeString];
                NSLog(@"%@ store name was added", store.name);
            }
        }
    }];

    return allStoreNames;
}
rdurand
  • 7,249
  • 3
  • 38
  • 72
  • Take a look at http://stackoverflow.com/a/322627/1835803 – Ajith R Nayak Oct 01 '14 at 09:46
  • 1
    Make sure you have **#import ** in your .m file – rdurand Oct 01 '14 at 10:04
  • I did that and now it says I don't have PFACL.h, I import it right under where I import Parse.h in the .m and then it says I still don't have it. I re downloaded the SDK added it to my project and confirmed this header file PFACL.h is indeed there. Still gives me the same error as if it won't read the line that says #import Has anyone else encountered this or have an idea of what I am missing? – nicowavemountain Oct 03 '14 at 08:01
  • Ok after adding #import to many parts of my project that use Parse the compiler now tells me that it can't find PFQuery.h which I also have checked and is in the Parse SDK and should be included when I #import I feel like I am going in circles. Is there something wrong with the way I added the SDK? I can't seem to figure out how the compiler is not finding these files. Anyone have an idea? – nicowavemountain Oct 03 '14 at 08:17

0 Answers0