diff --git a/ios/history.md b/ios/history.md index a6190f0819..95135d65f5 100644 --- a/ios/history.md +++ b/ios/history.md @@ -3,6 +3,9 @@ ## 13.0 alpha * Start version 13.0 +## 2019-12-19 12.0.63 stable +* Fixed issue with reinstalling or updating previously installed language resources from local files (#2461) + ## 2019-12-05 12.0.62 stable * Fix situation where lexical models would not install (#2420) diff --git a/ios/keyman/Keyman/Keyman/AppDelegate.swift b/ios/keyman/Keyman/Keyman/AppDelegate.swift index 4d7162426d..34076ee254 100644 --- a/ios/keyman/Keyman/Keyman/AppDelegate.swift +++ b/ios/keyman/Keyman/Keyman/AppDelegate.swift @@ -26,11 +26,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var destinationUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] destinationUrl.appendPathComponent("\(url.lastPathComponent).zip") do { - try FileManager.default.copyItem(at: url, to: destinationUrl) + let fileManager = FileManager.default + + // For now, we'll always allow overwriting. + if fileManager.fileExists(atPath: destinationUrl.path) { + try fileManager.removeItem(at: destinationUrl) + } + + // Throws an error if the destination file already exists, and there's no + // built-in override parameter. Hence, the previous if-block. + try fileManager.copyItem(at: url, to: destinationUrl) installAdhocKeyboard(url: destinationUrl) return true } catch { showKMPError(KMPError.copyFiles) + log.error(error) return false } }