Skip to content

'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release #548

Closed
@christoffer-woost

Description

@christoffer-woost

I recently hit a runtime error in our project.

A bit about my environment.

Minimum deployment target: iOS 14.3
Dependency installed via SPM
Mixpanel version 3.4.0

The error in question
'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release

The offending method

static func loadSuperProperties(apiToken: String) -> InternalProperties {
    guard let defaults = UserDefaults(suiteName: MixpanelUserDefaultsKeys.suiteName) else {
        return InternalProperties()
    }
    let prefix = "\(MixpanelUserDefaultsKeys.prefix)-\(apiToken)-"
    guard let superPropertiesData  = defaults.data(forKey: "\(prefix)\(MixpanelUserDefaultsKeys.superProperties)") else {
        return InternalProperties()
    }
    return NSKeyedUnarchiver.unarchiveObject(with: superPropertiesData) as? InternalProperties ?? InternalProperties()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions