Skip to content

Commit 0c35965

Browse files
committed
Fix app icon not displaying in macOS
- Generate AppIcon.icns from SF Symbol icon using rsvg-convert - Update AppIcon.appiconset Contents.json to reference .icns file - Add CFBundleIconFile key to Xcode project build settings - Add create-icns.sh script to regenerate icon if needed The app icon will now display properly in Finder and the Dock. Fixes: - Icon not showing in Finder - Generic app icon displayed instead of custom icon
1 parent 96e3388 commit 0c35965

5 files changed

Lines changed: 157 additions & 75 deletions

File tree

TablePro.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
/usr/local/opt/libpq/include,
273273
);
274274
INFOPLIST_KEY_CFBundleDisplayName = TablePro;
275+
INFOPLIST_KEY_CFBundleIconFile = AppIcon;
275276
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
276277
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
277278
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
@@ -364,6 +365,7 @@
364365
/usr/local/opt/libpq/include,
365366
);
366367
INFOPLIST_KEY_CFBundleDisplayName = TablePro;
368+
INFOPLIST_KEY_CFBundleIconFile = AppIcon;
367369
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
368370
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
369371
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
104 KB
Binary file not shown.

TablePro/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,8 @@
11
{
22
"images" : [
33
{
4-
"idiom" : "universal",
5-
"platform" : "ios",
6-
"size" : "1024x1024"
7-
},
8-
{
9-
"appearances" : [
10-
{
11-
"appearance" : "luminosity",
12-
"value" : "dark"
13-
}
14-
],
15-
"idiom" : "universal",
16-
"platform" : "ios",
17-
"size" : "1024x1024"
18-
},
19-
{
20-
"appearances" : [
21-
{
22-
"appearance" : "luminosity",
23-
"value" : "tinted"
24-
}
25-
],
26-
"idiom" : "universal",
27-
"platform" : "ios",
28-
"size" : "1024x1024"
29-
},
30-
{
31-
"idiom" : "mac",
32-
"scale" : "1x",
33-
"size" : "16x16"
34-
},
35-
{
36-
"idiom" : "mac",
37-
"scale" : "2x",
38-
"size" : "16x16"
39-
},
40-
{
41-
"idiom" : "mac",
42-
"scale" : "1x",
43-
"size" : "32x32"
44-
},
45-
{
46-
"idiom" : "mac",
47-
"scale" : "2x",
48-
"size" : "32x32"
49-
},
50-
{
51-
"idiom" : "mac",
52-
"scale" : "1x",
53-
"size" : "128x128"
54-
},
55-
{
56-
"idiom" : "mac",
57-
"scale" : "2x",
58-
"size" : "128x128"
59-
},
60-
{
61-
"idiom" : "mac",
62-
"scale" : "1x",
63-
"size" : "256x256"
64-
},
65-
{
66-
"idiom" : "mac",
67-
"scale" : "2x",
68-
"size" : "256x256"
69-
},
70-
{
71-
"idiom" : "mac",
72-
"scale" : "1x",
73-
"size" : "512x512"
74-
},
75-
{
76-
"idiom" : "mac",
77-
"scale" : "2x",
78-
"size" : "512x512"
4+
"filename" : "AppIcon.icns",
5+
"idiom" : "mac"
796
}
807
],
818
"info" : {

create-icns.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# Create AppIcon.icns from the SF Symbol icon
3+
# This script requires iconutil (built into macOS)
4+
5+
set -e
6+
7+
ICON_DIR="TablePro/AppIcon.icon"
8+
SVG_FILE="$ICON_DIR/Assets/cylinder.split.1x2.fill 1.svg"
9+
OUTPUT_ICONSET="TablePro/Assets.xcassets/AppIcon.appiconset/AppIcon.iconset"
10+
OUTPUT_ICNS="TablePro/Assets.xcassets/AppIcon.appiconset/AppIcon.icns"
11+
12+
echo "🎨 Creating AppIcon.icns from SF Symbol..."
13+
14+
# Check if SVG exists
15+
if [ ! -f "$SVG_FILE" ]; then
16+
echo "❌ ERROR: SVG file not found: $SVG_FILE"
17+
exit 1
18+
fi
19+
20+
# Create temporary iconset directory
21+
rm -rf "$OUTPUT_ICONSET"
22+
mkdir -p "$OUTPUT_ICONSET"
23+
24+
# Check if rsvg-convert is available (part of librsvg)
25+
if ! command -v rsvg-convert &> /dev/null; then
26+
echo "⚠️ rsvg-convert not found. Installing librsvg..."
27+
if command -v brew &> /dev/null; then
28+
brew install librsvg
29+
else
30+
echo "❌ ERROR: Homebrew not found. Please install librsvg manually."
31+
echo " Run: brew install librsvg"
32+
exit 1
33+
fi
34+
fi
35+
36+
# Generate PNG files at all required sizes
37+
# macOS icon sizes: 16, 32, 128, 256, 512, 1024 (and @2x versions)
38+
sizes=(16 32 128 256 512)
39+
40+
echo "📐 Generating icon sizes..."
41+
42+
for size in "${sizes[@]}"; do
43+
# 1x version
44+
rsvg-convert -w "$size" -h "$size" "$SVG_FILE" > "$OUTPUT_ICONSET/icon_${size}x${size}.png"
45+
echo " ✓ icon_${size}x${size}.png"
46+
47+
# 2x version
48+
size2x=$((size * 2))
49+
rsvg-convert -w "$size2x" -h "$size2x" "$SVG_FILE" > "$OUTPUT_ICONSET/icon_${size}x${size}@2x.png"
50+
echo " ✓ icon_${size}x${size}@2x.png"
51+
done
52+
53+
# 1024x1024 (no @2x version)
54+
rsvg-convert -w 1024 -h 1024 "$SVG_FILE" > "$OUTPUT_ICONSET/icon_512x512@2x.png"
55+
echo " ✓ icon_512x512@2x.png (1024x1024)"
56+
57+
echo ""
58+
echo "🔧 Creating .icns file..."
59+
60+
# Use iconutil to create .icns file
61+
iconutil -c icns "$OUTPUT_ICONSET" -o "$OUTPUT_ICNS"
62+
63+
# Clean up iconset directory
64+
rm -rf "$OUTPUT_ICONSET"
65+
66+
echo ""
67+
echo "✅ AppIcon.icns created successfully!"
68+
echo " Location: $OUTPUT_ICNS"
69+
echo ""
70+
echo "📋 Next steps:"
71+
echo " 1. Open Xcode project"
72+
echo " 2. Rebuild the app"
73+
echo " 3. The icon should now appear correctly"

generate-icons.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
# Generate app icons from SF Symbol SVG
3+
4+
set -e
5+
6+
SVG_FILE="TablePro/AppIcon.icon/Assets/cylinder.split.1x2.fill 1.svg"
7+
OUTPUT_DIR="TablePro/Assets.xcassets/AppIcon.appiconset"
8+
9+
if [ ! -f "$SVG_FILE" ]; then
10+
echo "❌ ERROR: SVG file not found: $SVG_FILE"
11+
exit 1
12+
fi
13+
14+
echo "🎨 Generating app icons from SF Symbol..."
15+
16+
# Create temporary directory
17+
TMP_DIR=$(mktemp -d)
18+
trap "rm -rf $TMP_DIR" EXIT
19+
20+
# Function to generate PNG from SVG using sips/qlmanage
21+
generate_png() {
22+
local size=$1
23+
local output=$2
24+
25+
# Use qlmanage to convert SVG to PNG (available on macOS)
26+
# First create a temporary high-res PNG, then resize
27+
qlmanage -t -s 1024 -o "$TMP_DIR" "$SVG_FILE" > /dev/null 2>&1
28+
29+
# Get the generated file (qlmanage adds .png extension)
30+
local temp_png=$(find "$TMP_DIR" -name "*.png" | head -1)
31+
32+
if [ -f "$temp_png" ]; then
33+
# Resize using sips
34+
sips -z "$size" "$size" "$temp_png" --out "$output" > /dev/null 2>&1
35+
echo " ✓ Created ${size}x${size} icon"
36+
else
37+
echo " ❌ Failed to create ${size}x${size} icon"
38+
return 1
39+
fi
40+
41+
# Clean temp files
42+
rm -f "$temp_png"
43+
}
44+
45+
# Note: macOS doesn't have imagemagick by default, so we'll use the .icon format
46+
# and create a proper icns file instead
47+
48+
echo ""
49+
echo "⚠️ Note: This script requires ImageMagick to generate icons."
50+
echo " Install with: brew install imagemagick"
51+
echo ""
52+
echo "Alternative: Use the AppIcon.icon format which is already configured."
53+
echo "The issue is that the build process needs to properly compile it."
54+
echo ""
55+
echo "Recommended fix: Update the Xcode project to use CFBundleIconFile = AppIcon"
56+
57+
# Check if ImageMagick is available
58+
if ! command -v convert &> /dev/null; then
59+
echo ""
60+
echo "❌ ImageMagick not found. Installing..."
61+
echo " Run: brew install imagemagick"
62+
exit 1
63+
fi
64+
65+
# Generate all required sizes
66+
sizes=(16 32 128 256 512 1024)
67+
68+
for size in "${sizes[@]}"; do
69+
generate_png "$size" "$OUTPUT_DIR/icon_${size}x${size}.png"
70+
71+
# Generate @2x versions
72+
if [ "$size" != "1024" ]; then
73+
local size2x=$((size * 2))
74+
generate_png "$size2x" "$OUTPUT_DIR/icon_${size}x${size}@2x.png"
75+
fi
76+
done
77+
78+
echo ""
79+
echo "✅ Icon generation complete!"
80+
echo " Icons saved to: $OUTPUT_DIR"

0 commit comments

Comments
 (0)