Reputation: 3350
I wanna setup a basic PFQuery Table View Controller. I wanna display the usernames from my User class. I've added the User class to query on, but it gives this error message: *Property 'className' not found on object of type 'InboxViewController '
I don't understand why happens this, because the user class exists, it appears in the data browser. I've tried to make a property in the .h file, but it was unsuccessful.
#import "InboxViewController.h"
#import <Parse/Parse.h>
#import "LoginViewController.m"
@interface InboxViewController ()
@end
@implementation InboxViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom the table
// The className to query on
self.className = @"User";
// The key of the PFObject to display in the label of the default cell style
self.textKey = @"username";
// Uncomment the following line to specify the key of a PFFile on the PFObject to display in the imageView of the default cell style
// self.imageKey = @"image";
// Whether the built-in pull-to-refresh is enabled
self.pullToRefreshEnabled = YES;
// Whether the built-in pagination is enabled
self.paginationEnabled = YES;
// The number of objects to show per page
self.objectsPerPage = 25;
}
return self;
}
#pragma mark - UIViewController
- (void)viewDidLoad
{
[super viewDidLoad];
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
NSLog(@"Current user: %@", currentUser.username);
} else {
[self performSegueWithIdentifier:@"showLogin" sender:self];
}
}
.h file
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface InboxViewController : PFQueryTableViewController
- (IBAction)logout:(id)sender;
@end
Upvotes: 0
Views: 170
Reputation: 77631
OK, I just remembered.
The property you are looking for is parseClassName
not className
.
Change this and it should work.
Upvotes: 1