CBLDatabase not creating in iPad

When I am creating CBLDatabase using below code

CBLDatabaseConfiguration* config = [[CBLDatabaseConfiguration alloc] init];
[config setDirectory:[[NSBundle mainBundle] resourcePath]];
CBLDatabase *db = [[CBLDatabase alloc] initWithName:@“test_DB” config:config error:&error];

db is nil when I am running the code in iPad,

getting error
Error Domain=NSPOSIXErrorDomain Code=1 “Operation not permitted” UserInfo={NSLocalizedDescription=Operation not permitted}

but When I am running into simulator it’s working fine.

Using below code
CBLDatabase *dbNew= [[CBLDatabase alloc] initWithName:@“test_DB” error:&error];
it’s working fine in both place without any issue.

OS Version : 15.7.1

Looks like you are writing to application bundle, which is causing the issue. Could you try open a database inside application/cache/temp directory?

1 Like