I'm new to Xcode, and I'm trying to create a class with arrays and a dictionary. I don't understand how to correctly initialize the object. What am I doing wrong?

**"maindata.h"**

```
#import <Foundation/Foundation.h>

@interface maindata : NSDictionary
{
    NSDictionary *maindict;
    NSArray      *arrayofallmethods;
    NSArray      *categories;
    NSArray      *methods;
}

@property(nonatomic,retain) NSDictionary *maindict;
@property(nonatomic,retain) NSArray      *categories;
@property(nonatomic,retain) NSArray      *methods;
@property(nonatomic,retain) NSString     *pathtoplist;

+(maindata *) shareddata;

@end

```

**"maindata.m"**

```
#import "maindata.h"

@implementation maindata

@synthesize maindict;
@synthesize methods;
@synthesize categories;
@synthesize pathtoplist;

static maindata *shareddata_;

-(id)init
{
    if(self == [super init])
    {
        pathtoplist = [[NSBundle mainBundle] pathForResource:@"allData" ofType:@"plist"];
        shareddata_.maindict = [NSMutableDictionary dictionaryWithContentsOfFile:pathtoplist];
        shareddata_.methods = [maindict allValues];
    }

    return shareddata_;
}

+(maindata *) shareddata
{
    if (!shareddata_)
    {
        shareddata_ = [[maindata alloc] init];
    }

    return shareddata_;
}

@end

```