project-imas / encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Other
785 stars 236 forks source link

Crash after migrating from IOS12 to IOS13 #323

Open ovidiuadorian opened 4 years ago

ovidiuadorian commented 4 years ago

There seems to be a crash after migrating from IOS 12 to IOS 13. Some things have changed it the app is crashing.

The error is here:

I believe is something related to NSData type that changed his behaviour of description method.

I've investigated but did not found a fix for it till now.

Did someone encountered something the same?

Thx

ovidiuadorian commented 4 years ago

I ended up deleting the DB and recreate it at startup

jcavar commented 4 years ago

I think the problem is introduction of NSStoreModelVersionHashesDigest metadata option in iOS 13. NSPersistentStore internally checks if it is set, and tries to load metadata again. This second attempt to load metadata fails because we are already inside of transaction.

jcavar commented 4 years ago

I was able to fix it by doing: [metadata setValue:@"" forKey:@"NSStoreModelVersionHashesDigest"]; in EncryptedStore.m.

This might not be safe solution, as this is private identifier, so some internal code might rely on it.

ovidiuadorian commented 4 years ago

Yeah, they added it and its not documented, I don't know if there are any other implications. Strange that even looking at "NSStoreModelVersionHashesDigest" on Apple website returns no results.

It seems an internal code