3 posts / 0 new
Last post
Grumme
database could not be initialized

Everytime i try to load and save anything to the database with the HueSDK for Swift, i'm getting the following error:

HueSDK::Support ~ <ERROR>  : Db: init: coudld not open db, file: /var/mobile/Containers/Data/Application/977FDB05-3F5F-4BD6-BBE3-C207187D5221/known_bridges.sqlite. SQLITE error code: 14, error msg:

2018-01-13 22:22:01.678922+0100 Home Alarm[33290:9869990] HueSDK::Support ~ <ERROR>  : Db: get_db: could not get database, name: known_bridges, code: 2

2018-01-13 22:22:01.678969+0100 Home Alarm[33290:9869990] HueSDK::Core    ~ <ERROR>  : GenericDataPersistence: database could not be initialized

nil

 

EDIT:

In AppDelegate, i have the following:

 

PHSPersistence.setStorageLocation(NSHomeDirectory(), andDeviceId: "0011223344552")

 

Can someone please tell me, what i'm doing wrong :-)?

 

EDIT 2:

Okay, it seems like it's working if i use the Simulator. But how can i make it work on my device also?

jesus.bsoul.garcia
Same problem here. Any

Same problem here. Any solution?

jesus.bsoul.garcia
Well, we found that the Swift

Well, we found that the Swift example is wrong: 

In the example, the Persistence is pointing to the NSHomeDirectory:

PHSPersistence.setStorageLocation(NSHomeDirectory(), andDeviceId: "0011223344552")

But it should be pointing the Documents directory:

let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)

PHSPersistence.setStorageLocation(paths[0], andDeviceId: "0011223344552")

Log in or register to post comments