Closed
Description
Minimal reproducible example
https://github.com/leonhh/expo-font-reproducer
What platform(s) does this occur on?
iOS
Did you reproduce this issue in a development build?
Yes
Summary
I'm in the process of updating my app to SDK 51 when I encountered an issue with font registration/unregistration on iOS in combination with hot-reload.
SDK 50 works fine:
npm install expo@50
npx expo install --fix
npx expo prebuild --clean
iOS Bundled 1641ms (node_modules/expo/AppEntry.js)
LOG {"fontError": null}
LOG {"fontError": null}
› Reloading apps
iOS Bundled 32ms (node_modules/expo/AppEntry.js)
LOG {"fontError": null}
LOG {"fontError": null}
Update epxo to SDK 51:
npm install expo@51
npx expo install --fix
npx expo prebuild --clean
With expo-font 12.0.0 an error is thrown when the app is started:
iOS Bundled 1533ms node_modules/expo/AppEntry.js (638 modules)
LOG {"fontError": null}
LOG {"fontError": [Error: Calling the 'loadAsync' function has failed
→ Caused by: Registering 'Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=305 "Could not register the CGFont '<CGFont (0x600003a5ea80): Danfo-Regular>'" UserInfo={NSDescription=Could not register the CGFont '<CGFont (0x600003a5ea80): Danfo-Regular>', CTFailedCGFont=<CGFont (0x600003a5ea80): Danfo-Regular>}' font failed with message: 'The operation couldn’t be completed. (com.apple.CoreText.CTFontManagerErrorDomain error 305 - Could not register the CGFont '<CGFont (0x600003a5ea80): Danfo-Regular>')']}
With expo-font 12.0.5 an error is thrown only when reloading the app (pressing r
in the terminal):
iOS Bundled 1598ms node_modules/expo/AppEntry.js (608 modules)
LOG {"fontError": null}
LOG {"fontError": null}
› Reloading apps
iOS Bundled 40ms node_modules/expo/AppEntry.js (1 module)
LOG {"fontError": null}
LOG {"fontError": [Error: Calling the 'loadAsync' function has failed
→ Caused by: Registering 'Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=203 "Could not unregister the CGFont '<CGFont (0x6000011f5c00): Danfo-Regular>'" UserInfo={NSDescription=Could not unregister the CGFont '<CGFont (0x6000011f5c00): Danfo-Regular>', CTFailedCGFont=<CGFont (0x6000011f5c00): Danfo-Regular>}' font failed with message: 'The operation couldn’t be completed. (com.apple.CoreText.CTFontManagerErrorDomain error 203 - Could not unregister the CGFont '<CGFont (0x6000011f5c00): Danfo-Regular>')']}
Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.11.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode: 15.4/15F31d - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.8 => 51.0.8
react: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
npmGlobalPackages:
eas-cli: 7.3.0
Expo Workflow: bare
Expo Doctor Diagnostics
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check native tooling versions
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that packages match versions required by installed Expo SDK
Didn't find any issues with the project!