diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 27140b45..cb0da7e0 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -1056,6 +1056,26 @@ private extension AppManager exportedUTIs.append(installedAppUTI) infoDictionary[Bundle.Info.exportedUTIs] = exportedUTIs + if let cachedApp = ALTApplication(fileURL: app.fileURL), let icon = cachedApp.icon?.resizing(to: CGSize(width: 180, height: 180)) + { + let iconFileURL = unzippedAppBundleURL.appendingPathComponent("AppIcon.png") + + if let iconData = icon.pngData() + { + do + { + try iconData.write(to: iconFileURL, options: .atomic) + + let bundleIcons = ["CFBundlePrimaryIcon": ["CFBundleIconFiles": [iconFileURL.lastPathComponent]]] + infoDictionary["CFBundleIcons"] = bundleIcons + } + catch + { + print("Failed to write app icon data.", error) + } + } + } + try (infoDictionary as NSDictionary).write(to: unzippedAppBundle.infoPlistURL) }