From f57d3f7df8f62e9725b02b9ac3a7d482111e1269 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 10 Oct 2019 14:44:20 -0500 Subject: [PATCH] Prepend team name to shared user defaults to get rid of warning and hopefully prevent user default corruption --- iOS/AppDefaults.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index dcf2439a5..53589a0dc 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -10,7 +10,11 @@ import UIKit struct AppDefaults { - static var shared = UserDefaults.init(suiteName: "group.\(Bundle.main.bundleIdentifier!)")! + static var shared: UserDefaults = { + let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String + let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)" + return UserDefaults.init(suiteName: suiteName)! + }() struct Key { static let lastImageCacheFlushDate = "lastImageCacheFlushDate"