SDK42 expo-fonts won't load TTF

After upgrading my Bare Workflow project to Expo SDK 42 my icomoon font (TTF) won’t load anymore in a release build. It loaded fine in SDK 41. It loads fine in debug build. My other fonts (OTF) load fine in the release build. The error I’m getting is “Error: Could not create font from loaded data for ‘’”.

The changelog for SDK 42 isn’t mentioning anything.

Any idea what could be happening here?

Hey @rodneyrehm, is this occurring for ios, android, both? Can you share all the relevant versions for packages such as expo-font, expo-asset, expo, etc?

Cheers,
Adam

Hey @adamjnav,

upon further inspection this is only happening on iOS. Android is loading the TTF just fine.

expo@42.0.3
expo-asset@8.3.3
expo-font@9.2.1

expo diagnostics

  Expo CLI 4.8.1 environment info:
    System:
      OS: macOS 11.4
      Shell: 5.8 - /usr/local/bin/zsh
    Binaries:
      Node: 14.16.1 - /usr/local/bin/node
      npm: 7.12.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.10.1 - /usr/local/lib/ruby/gems/2.7.0/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
      Android SDK:
        API Levels: 28, 29, 30
        Build Tools: 28.0.3, 29.0.2
        System Images: android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.7199119
      Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^42.0.0 => 42.0.3
      react: 16.13.1 => 16.13.1
      react-dom: 16.13.1 => 16.13.1
      react-native: 0.63.4 => 0.63.4
      react-native-web: ~0.13.12 => 0.13.18
    npmGlobalPackages:
      expo-cli: 4.8.1
    Expo Workflow: bare

not sure why it’s taken me so long to check this in Expo Go… But on iOS it fails with the following error:

[Unhandled promise rejection: Error: Unable to download file: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=my-fancy-icons.ttf, NSErrorFailingURLKey=my-fancy-icons.ttf, _NSURLErrorRelatedURLSessionTaskErrorKey=(]
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-file-system/build/FileSystem.js:105:17 in downloadAsync
at node_modules/expo-file-system/build/FileSystem.js:101:7 in downloadAsync
at node_modules/expo-asset/build/PlatformUtils.js:49:25 in _downloadAsyncManagedEnv
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

On Android I see

[Unhandled promise rejection: Error: Resource ID #0x0]
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-file-system/build/FileSystem.js:105:17 in downloadAsync
at node_modules/expo-file-system/build/FileSystem.js:101:7 in downloadAsync
at node_modules/expo-asset/build/PlatformUtils.js:49:25 in _downloadAsyncManagedEnv
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

I’m not sure where the unhandled promise rejection is coming from, though. I’m using

const [fontsLoaded, fontLoadingError] = useFonts({
  ...Ionicons.font,
  'my-fancy-icons': require('./assets/my-fancy-icons.ttf'),
  'my-fancy-font': require('./assets/my-fancy-font.otf'),
})

I have a similar problem with SDK42, my custom icons are not getting displayed on iOS using ‘react-native run-ios’ in the logs show this error

Error: Unable to download file: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=icomoon.ttf, NSErrorFailingURLKey=icomoon.ttf, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundDownloadTask <B19C906E-EF44-4E24-B38D-0FB6B35340C7>.<7>"
),
1 Like

https://github.com/expo/expo/issues/13839

1 Like