pinterest / PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Carthage vs SPM differences

icedice opened this issue · comments

So I'm currently migrating from Carthage to SPM. After doing so I started seeing crashes that looked to be related to PINCache, so i tested some more.

I made two projects one using PINCache with SPM and one with Carthage thats the only difference. They basically just have this code:

import UIKit
import PINCache

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let cache = PINCache(name: "test")
        cache.setObjectAsync("test", forKey: "test", withAgeLimit: 666666)
    }
}

The one using Carthage seems to be working just fine however the one using SPM immediately throws this exception

2021-10-14 18:35:46.328136+0200 CachingTest[11466:3492388] *** Assertion failure in -[PINDiskCache setObject:forKey:withAgeLimit:fileURL:], PINDiskCache.m:1184
2021-10-14 18:35:46.328130+0200 CachingTest[11466:3492384] *** Assertion failure in -[PINMemoryCache setObject:forKey:withCost:ageLimit:], PINMemoryCache.m:510
2021-10-14 18:35:46.357156+0200 CachingTest[11466:3492388] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ttlCache must be set to YES if setting an object-level age limit.'
*** First throw call stack:
(0x1827fc05c 0x19ad16f54 0x1840bd99c 0x1028fb688 0x1028fb39c 0x1028f1838 0x10290544c 0x102906b14 0x102907ef0 0x102c04a20 0x102c06700 0x102c098a0 0x102c08af0 0x102c1a688 0x102c1b08c 0x1f2c31174 0x1f2c30f50)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ttlCache must be set to YES if setting an object-level age limit.'
terminating with uncaught exception of type NSException

What on earth am I doing wrong here? How can the functionality change based on if I use Carthage or SPM?

Both SPM and Carthage dependencies have this version numbers:

PINOperation at "1.2.1"
PINCache at "3.0.3"