datatheorem/TrustKit

Crash in TSKSPKIHashCache.m line 234

tadija opened this issue · 3 comments

Hi,

lately we noticed increased crash rate coming from TrustKit (in thousands, although I could never reproduce it locally).

At first I thought it's related to #248 or #249 so when 2.0.0 release came out I updated TrustKit dependency hoping that it brings a fix for this and closed the crash on Crashlytics.

Unfortunately, we keep getting the crash afterwards and apparently now it comes from this line:

NSAssert(false, @"Failed to write cache");

I suspect it might have something to do with "Data Protection" capability being enabled in our project (ie. disk locked at the moment of writing cache) but I'm not sure how (or where) to fix it. Any ideas?

Using NSAssert here, when failing to write to the cache, feels a little excessive.

Is crashing really the best option here?

I have a PR up to fix the build settings when using SwiftPM. SwiftPM doesn't set NS_BLOCK_ASSERTIONS by default.

I just released the fix as part of v2.0.1 (https://github.com/datatheorem/TrustKit/releases/tag/2.0.1). Thanks for your patience!