I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...
React Native iOS 修复:MaterialIcons 显示 “?”(字体未加载问题完整解决方案)
- Get link
- X
- Other Apps
By
Errong Leng
-
React Native iOS 修复:MaterialIcons 显示 “?”(字体未加载问题完整解决方案)
如果你的 React Native 应用在 iOS 上显示 ? 而不是 MaterialIcons 图标,通常是因为 iOS 没有正确加载图标字体导致的。
本文将讲解:
- 问题出现的原因
- 完整修复方法
- 常见坑:Multiple commands produce MaterialIcons.ttf
问题现象
你可能在代码中使用:
import MaterialIcons from '@react-native-vector-icons/material-icons';
并这样渲染图标:
<MaterialIcons name="dashboard" size={24} color="#2563eb" />
但在 iOS 上出现:
- 显示
? - 图标为空白
- 图标无法显示
根本原因
问题的核心是 MaterialIcons.ttf 没有被正确加载到 iOS App Bundle 中。
在 iOS 中,字体必须满足:
- 被加入 App 资源文件
- 在
Info.plist中注册
如果缺少任何一步,iOS 就无法渲染字体图标,只会显示 ?。
解决方案(推荐做法)
第一步:在 Info.plist 注册字体
打开文件:
ios/<YourAppName>/Info.plist
添加以下内容:
<key>UIAppFonts</key>
<array>
<string>MaterialIcons.ttf</string>
</array>
如果已经存在 UIAppFonts,只需追加:
<string>MaterialIcons.ttf</string>
第二步:清理并重新构建 iOS 项目
修改 Info.plist 后必须重新编译 App。
方法一:Xcode
- Product → Clean Build Folder
- 删除模拟器或真机上的 App
- 重新运行
方法二:命令行
npm run ios
如果问题仍然存在:
rm -rf ~/Library/Developer/Xcode/DerivedData
然后再次重新构建。
常见问题:Multiple commands produce MaterialIcons.ttf
你可能会看到以下错误:
Multiple commands produce ... MaterialIcons.ttf
原因
字体被重复复制了:
- Xcode Build Phases(Copy Bundle Resources)
- CocoaPods 自动复制资源
解决字体重复复制问题
必须确保 只有一个来源 复制字体文件。
方案一(推荐)
如果 CocoaPods 已经处理字体:
删除:
Build Phases → Copy Bundle Resources
中的 MaterialIcons.ttf
方案二
如果你手动管理字体:
- 确保 CocoaPods 没有重复复制
修复后:
- Clean Build
- 重新运行 App
为什么 iOS 比 Android 更容易出现这个问题
iOS 对资源管理更严格:
- 必须在 Info.plist 中注册字体
- 必须正确打包到 App Bundle
- 没有 Android 那种自动字体 fallback
任何一步遗漏都会导致图标显示 ?。
快速检查清单
- ✔ 项目中存在 MaterialIcons.ttf
- ✔ Info.plist 中有 UIAppFonts
- ✔ UIAppFonts 中已添加字体
- ✔ Xcode 没有重复字体拷贝
- ✔ 已清理并重新构建
最终正确代码
import MaterialIcons from '@react-native-vector-icons/material-icons';
<MaterialIcons name="dashboard" size={24} color="#2563eb" />
注意:代码本身没有问题,问题在于 iOS 原生字体加载配置。
总结
如果 iOS 上 MaterialIcons 显示 ?:
- 在 Info.plist 中注册 MaterialIcons.ttf
- 避免 Xcode / CocoaPods 重复复制字体
- 清理并重新构建项目
完成以上步骤后,图标即可在 iOS 正常显示。
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
CocoaPods
Code
iOS
ios字体问题
ios构建错误
ios调试
materialicons
materialicons不显示
React Native
react native ios修复
uiappfonts
Xcode
向量图标
字体未加载
- Get link
- X
- Other Apps
Popular Posts
2026 Begins: Choosing to Stay on the Path as a Blogger
By
Errong Leng
-
Today is January 1st, 2026 . Before rushing into new goals, I spent some time looking back at the past 12 months of data for this blog — the quiet numbers that tell a very honest story. Looking Back at the Numbers Over the past year: 📈 Total views: ~44,600 👀 Daily average visits: ~200 💬 Comments: 19 💰 AdSense income: about $0.01 per month At first glance, these numbers may look small — especially the income. But when I zoom out, I see something more meaningful. This blog has been quietly read every single day . No viral posts. No aggressive promotion. No paid traffic. Just consistent readers arriving through search, bookmarks, and curiosity. That consistency matters. What the Traffic Graph Tells Me The graph over the last 12 months shows something important: Early months were quiet and uneven Mid-year brought steady growth Toward the end of the year, traffic became more stable , with clear spikes when certain posts resonated This tell...
Cross compile tensorflow for armv7l targets via bazel
By
三好Daddy
-
Health Checks and Scaling Strategies for Next.js in Kubernetes
By
Errong Leng
-
Health Checks and Scaling Strategies for Next.js in Kubernetes This is Part 6 and the final post of the series: Self-Hosting Next.js in Kubernetes (Without Vercel) . At this point, your Next.js standalone app: Builds cleanly Runs in a minimal Docker image Deploys correctly on Kubernetes / OpenShift Serves static assets properly Uses runtime configuration and secrets Now let’s make it resilient and scalable . Why Health Checks Matter Kubernetes relies on health checks to: Know when a pod is ready to receive traffic Restart unhealthy containers Safely roll out new versions Without proper probes, traffic can be sent to a pod that isn’t ready yet. Readiness Probe A readiness probe tells Kubernetes: “This pod can accept traffic.” For most Next.js apps, the root path works well: readinessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 10 periodSeconds: 5 If your app depends on downstream services (APIs, d...
Comments
Post a Comment