Unable to save data in CouchBaseLite in swift when device is Locked

I am using CouchBaseLite 2.7
Whenever my device gets locked i can’t save data in CouchBaseLite in swift.
what would be the problem?
If it is related to Data Protection in device locked state then how do i enable for CouchBaseLite in swift?
Any help would be appreciated . Thanks