From 2411cca51f46c4013ed8feab3e5b4e964134257c Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 21 May 2020 21:00:05 -0700 Subject: [PATCH] =?UTF-8?q?[AltServer]=20Suggests=20disabling=20=E2=80=9CO?= =?UTF-8?q?ffload=20Unused=20Apps=E2=80=9D=20in=20error=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iOS 13.5 counts offloaded apps as active sideloaded apps (for some reason), so improve error messages to mention this. --- AltKit/CodableServerError.swift | 8 +++++++- AltKit/NSError+ALTServerError.m | 3 +++ AltServer/AppDelegate.swift | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/AltKit/CodableServerError.swift b/AltKit/CodableServerError.swift index 5dff7787..7ada01df 100644 --- a/AltKit/CodableServerError.swift +++ b/AltKit/CodableServerError.swift @@ -30,7 +30,13 @@ struct CodableServerError: Codable { self.errorCode = error.code - let userInfo = error.userInfo.compactMapValues { $0 as? String } + var userInfo = error.userInfo.compactMapValues { $0 as? String } + + if let localizedRecoverySuggestion = (error as NSError).localizedRecoverySuggestion + { + userInfo[NSLocalizedRecoverySuggestionErrorKey] = localizedRecoverySuggestion + } + if !userInfo.isEmpty { self.userInfo = userInfo diff --git a/AltKit/NSError+ALTServerError.m b/AltKit/NSError+ALTServerError.m index c82da672..3fdf5ad1 100644 --- a/AltKit/NSError+ALTServerError.m +++ b/AltKit/NSError+ALTServerError.m @@ -112,6 +112,9 @@ NSErrorUserInfoKey const ALTProvisioningProfileBundleIDErrorKey = @"bundleIdenti case ALTServerErrorPluginNotFound: return NSLocalizedString(@"Make sure Mail is running and the plug-in is enabled in Mail's preferences.", @""); + case ALTServerErrorMaximumFreeAppLimitReached: + return NSLocalizedString(@"Make sure “Offload Unused Apps” is disabled in Settings > iTunes & App Stores, then install or delete all offloaded apps.", @""); + default: return nil; } diff --git a/AltServer/AppDelegate.swift b/AltServer/AppDelegate.swift index 34a3790f..84382a6f 100644 --- a/AltServer/AppDelegate.swift +++ b/AltServer/AppDelegate.swift @@ -212,6 +212,10 @@ private extension AppDelegate { alert.informativeText = underlyingError.localizedDescription } + else if let recoverySuggestion = error.localizedRecoverySuggestion + { + alert.informativeText = error.localizedDescription + "\n\n" + recoverySuggestion + } else { alert.informativeText = error.localizedDescription