Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo-font] Could not unregister the CGFont #28948

Closed
leonhh opened this issue May 17, 2024 · 4 comments · Fixed by #28989
Closed

[expo-font] Could not unregister the CGFont #28948

leonhh opened this issue May 17, 2024 · 4 comments · Fixed by #28989
Assignees
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@leonhh
Copy link
Contributor

leonhh commented May 17, 2024

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!
@leonhh leonhh added the needs validation Issue needs to be validated label May 17, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 17, 2024
@MehediH
Copy link

MehediH commented May 19, 2024

Can reproduce this as well in expo 51, with expo-font@12.0.2

@anstapol
Copy link

Same here expo@51.0.8 and expo-font@12.0.5

@ryskin
Copy link

ryskin commented May 22, 2024

same (

@diceros-soojungkim
Copy link

This is also a problem for me too..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants