I'm using Core Data API in my iOS application. Also, I'm using the commoncrypto library (CCCrypt()) to encrypt/decrypt the database file(.sqlite file) that resides in the documents folder when the application state changes (Background/Foreground).
The problem which i'm facing is... some of the records in the database gets lost when the application is killed manually by the user from the background state and this issue is inconsistent.
I'm just converting the sqlite file contents into NSData and used as an input to CCCrypt() function to encrypt/decrypt and I'm not decoding the any input data in the crypt operation.
Can someone please help me .....what could be reason for the data loss ? that too only when the application gets killed manually from the background state ..... For both encryption and decryption operation, the CCCrypt function returns the status as kCCSuccess...
Does it needed to use any sort of decoding the input data (raw bytes) before CCCrypt operation ?