skip to Main Content

I currently have an app in TestFlight on apple for beta testing, but being my first time, I’m experiencing difficulty in troubleshooting crashes that are occurring.

When I test it in a simulator and on my phone via Expo Go, there’s nothing wrong and it’s just crashing while in a production build.

On one crash report I believe the thread that crashed was the following:

Thread 2 name:
Thread 2 Crashed:
0   CoreFoundation                  0x0000000190771038 CF_IS_OBJC + 24 (CFRuntime.c:472)
1   CoreFoundation                  0x00000001907711dc CFStringGetLength + 148 (CFString.c:2484)
2   CoreFoundation                  0x00000001907c81dc CFStringFind + 60 (CFString.c:4495)
3   Pumpzoid                        0x0000000104be1bf0 weightOfFont(UIFont*) + 212 (RCTFont.mm:60)
4   Pumpzoid                        0x0000000104be16e4 +[RCTFont updateFont:withFamily:size:weight:style:variant:scaleMultiplier:] + 1788 (RCTFont.mm:477)
5   Pumpzoid                        0x0000000104d7cd30 -[RCTTextAttributes effectiveFont] + 128 (RCTTextAttributes.mm:220)
6   Pumpzoid                        0x0000000104d7c910 -[RCTTextAttributes effectiveTextAttributes] + 64 (RCTTextAttributes.mm:150)
7   Pumpzoid                        0x0000000104d78b60 -[RCTBaseTextShadowView attributedTextWithBaseTextAttributes:] + 472 (RCTBaseTextShadowView.mm:101)
8   Pumpzoid                        0x0000000104d78bd8 -[RCTBaseTextShadowView attributedTextWithBaseTextAttributes:] + 592 (RCTBaseTextShadowView.mm:111)
9   Pumpzoid                        0x0000000104d7e740 -[RCTTextShadowView attributedTextWithMeasuredAttachmentsThatFitSize:] + 80 (RCTTextShadowView.mm:179)
10  Pumpzoid                        0x0000000104d7eac0 -[RCTTextShadowView textStorageAndLayoutManagerThatFitsSize:exclusiveOwnership:] + 312 (RCTTextShadowView.mm:227)
11  Pumpzoid                        0x0000000104d7db34 RCTTextShadowViewMeasure(YGNode const*, float, YGMeasureMode, float, YGMeasureMode) + 132 (RCTTextShadowView.mm:385)

Specifically where the weightOfFont(UIFont*) + 212 (RCTFont.mm:60) is occuring.

At first glance this tells me that I need to check where I’m using fontWeights, so I do and there’s nothing out of ordinary with how I use them. The error isn’t exactly descriptive so if anyone can provide insight I’d appreciate it!

Update #1: Actually looking through five different crash reports, it seems that weightOfFont… is the cause of each crash.

Update #2: More steps that I’ve taken to potentially fix it, but haven’t:

  • Rename the Fonts folder to font. One different post mentioned it had worked for them.
  • Add the following to my app.json: "assetBundlePatterns": [ "assets/*" ],
  • Ran npx expo-doctor@latest to make sure everything worked, and it there’s no errors or warnings.
  • A different post said to try to do use this to link your assets npx react-native-asset
  • I’ve also created a react-native.config.js where I put module.exports = { assets: ['./assets/font'], };

Update #3: More steps that I’ve taken to potentially fix it, but haven’t:

  • I came to potentially believe that I might be loading my fonts incorrectly, and when I swap between screens it might not be properly reloading (granted I was under the assumption once the app loads, I wouldn’t have to worry about if the fonts are loaded.) I altered my font’s loading to the following: (

    try {
                Font.loadAsync({
                    'RobotoSlab-Medium': require('./assets/font/RobotoSlab-Medium.ttf'),
                    'RobotoSlab-Bold': require('./assets/font/RobotoSlab-Bold.ttf')
                }).then(() => {
                    setFontLoaded(true)
                    setAppIsReady(true);
                })
            } catch (e) {
                console.warn('Fonts are not loaded properly');
                console.log(e)
            }

Update #4: Currently testing

  • On Expo-Fonts Docs it mentions that you can either use embedded fonts or load at runtime. After reading this, I realized I am currently embedding my fonts and loading them at runtime. I deleted my plugins… fonts from my so I could focus on loading them at runtime. Hopefully this fixes it.

!! I think the embedded and runtime load was my issue. App isn’t crashing at all when used in production build !!

2

Answers


  1. Chosen as BEST ANSWER

    I deleted my embedded fonts so I can use the load at runtime. It entailed deleting plugins of fonts.


  2. Seeing something similar with expo-google-fonts/inter – see this github issue https://github.com/expo/google-fonts/issues/109

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search