YAPdatabase connexion is null

83 Views Asked by At

I try to install yapdatabase on my project and i have the problem that self.connexion is null.

@implementation DataManager

- (instancetype)init {
    self = [super init];
    if (self) {
        self.database = [[YapDatabase alloc] initWithPath:@"myDtabase.sqlite"];
        self.connexion = [self.database newConnection];  
    }
    return self;
}

-(NSMutableArray *)getArtists {
    NSLog(@"%@", self.connexion);
}

What's wrong ?

1

There are 1 best solutions below

2
On BEST ANSWER

You need to properly construct the path to the database file:

[[NSBundle mainBundle] pathForResource:@"myDtabase.sqlite" ofType:nil]

This is a required step to access the resources bundled within your app on iOS.