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
Fix “A problem occurred starting process 'command node'” in Android Studio for React Native
By
Errong Leng
-
Fix “A problem occurred starting process 'command node'” in Android Studio for React Native If you are building a React Native Android project and encounter this error during Gradle sync: A problem occurred evaluating project ':react-native-svg'. > A problem occurred starting process 'command 'node'' —even though node works perfectly in your terminal—this guide will show you how to fix it quickly. Common Misconceptions This error is often mistaken as a Node.js or PATH issue, but that is not always the case. Node.js is installed and working in your terminal. PATH and environment variables appear correct. Still, Android Studio Gradle sync fails with the above error. The Real Cause The issue typically arises because of an incorrect Gradle JDK configuration inside Android Studio . Gradle runs inside a JVM and uses that JVM to spawn external processes (like node ). If the Gradle JDK is incompatible or misconfigured, Gradle will...
Swagger annotations for API that allows downloading files as zip
By
三好Daddy
-
I have built out an API that allows you downloading log files as zip in a sprint boot app. The app also integrated with Swagger 3, so I also want this API can be hit in the Swagger UI. In this post, I will demonstrate how to use @ApiOperation annotation to tell Swagger UI download the response as a zip file. use @ApiOperation for your method The key is set media type to "application/octet-stream" which can be recognized by Swagger UI. By doing so, you are set "accept":" application/octet-stream " in the request header. Put below annotation section on top of your API's controller method. @Operation( summary = "", description = "", method="GET", responses = { @ApiResponse(responseCode = "200", description = "", content = { @Content( mediaType = "application/octet-stream" ...
2023, New Start! New AdSense Account! New Earnings!
By
Errong Leng
-
It's been a while after I created adsense account to display ads on this blog. A few years later the payment finally reached my payout threshold, I just found the existed adsense account is bind to China. but I moved to Canada 3 years ago. I tried to change the country of it, but just found Unfortunately it's not possible to change the country of your payment address in AdSense. If you've moved to a new country or territory, you'll need to cancel your existing AdSense account and create a new AdSense account . So I created a new adsense account today on 2023-01-12. Though new account is still under reviewing, I believe it will be approved soon. To reach out payout threshold in this year, I set up the below plan: write one blog per week day!!! write one blog per week day!!! write one blog per week day!!! Try ingress more traffic to this blog
Comments
Post a Comment