13

I have a problem loading custom fonts in the drop down menu to select fonts in storyboard, I have poppins font and MarvinVisionsBig. I have already added them as target membership, bundle resources and added them to the plist and they are already installed in the system. I tried everything but nothing seems to be working.

The fonts are printed when using this to show them :

for family: String in UIFont.familyNames {
    print(family)
    for names: String in UIFont.fontNames(forFamilyName: family) {
        print("== \(names)")
    }
}

Console:

enter image description here

DropDown:

enter image description here

Fonts:

enter image description here

Bundle resources:

enter image description here

Plist:

enter image description here

Sohil R. Memon
  • 9,404
  • 1
  • 31
  • 57
  • 1
    I've the same issue -- noticed it was working in Xcode 10/Mojave but after upgrading to Catalina (not Xcode 11) the issue appeared as it was working for me in Xcode 11/Mojave – Sean Dev Oct 18 '19 at 16:42
  • @SeanDev yeah the problem is from catalina, in my personnal computer i kept mojave and xCode 11 is working fine but with catalina i find this problem. Hopefully apple will come up with a fix for this.. – mohamed mernissi Oct 24 '19 at 21:09
  • Anyone got the solution for this? – Hilaj S L Nov 21 '19 at 08:46
  • anyone got the solution?? – Sachin Kishore Jan 11 '20 at 02:48
  • In the info.plist type the entire file name including the file extension. For example, "Fonts provided by application" should have Poppins-Bold.ttf listed. – Marcy Apr 26 '22 at 03:05

9 Answers9

1

Unfortunately, the only solution for me was a fresh install of mac os catalina. Now everything works correctly in xCode interface builder.

1

change your project location and go in activity monitor quiet Xcode and simulator then it works

Sachin Kishore
  • 324
  • 3
  • 8
1
  1. remove info.plist from Bundle Resources (->Build Phases ->Copy Bundle Resources)

  2. add Fonts capability and Privileges (->Signing & Capabilities -> +Capabilty ->select 'Fonts' -> Check 'Install Fonts' and 'Use Installed Fonts')

image: Xcode screenshot

Abhilash Chandran
  • 6,803
  • 3
  • 32
  • 50
Sarah
  • 19
  • 4
1

This is a known issue in upgrading to Xcode 11.4, which is seemingly only affecting users who upgraded to Catalina instead of clean install.

In theory, having the fonts in your Info.plist and setting the Font entitlement should work but I could not get it to cooperate. My solution is not recommended as it could corrupt your Xcode but just as quick fix for anyone spending hours on this and don't want to roll back.

This is a no-code solution. What you need to do is compile for 13.4 from Xcode 11.3.1.

  1. Explore the Package Contents of Xcode 11.4 beta and copy the folder labeled '13.4' from Contents > Developer > Platforms > iPhoneOS > DeviceSupport.
  2. Paste it in the same directory location inside Xcode 11.3.1.
  3. Open your project/workspace in 11.3.1.
  4. CMD+Shift+K to clean and run it again. Fonts should now behave as expected.
  5. If the issue still persists delete the app from your device/simulator and try steps 3 and 4 again.
0

I think this is a bug of the new Xcode version or the compiler from Catalina, right now to work around this problem is to specify your font extension when adding them to Fonts provided by application in your .plist file

Something like this Poppins-Bold.otf or Poppins-Bold.ttf

I've tried this and it works

Kent
  • 2,952
  • 2
  • 25
  • 42
0

I was able to see the font in the list if I change the label to an Attributed Text and it remains once switching back to Plain but I haven't figure out how to fix the issue sans a full reinstall which I did about 3 weeks ago anyway.

TeddyCode
  • 94
  • 7
0

Try to remove the reference of the font, then add them to the project again, worked for me, as simple as that be.

amit
  • 224
  • 2
  • 6
0

Using Xcode 12.4 on Catalina, I had this problem. What I discovered was that I had added the font files to my project directly from the download folder and neglected to copy them into the app directory. I deleted the files, copied them externally using Finder into my app directory, and then readded them. Then it worked!

Andy Weinstein
  • 2,639
  • 3
  • 21
  • 32
0

I've been wrestling with this problem for a whole day. I finally solved it by changing the key name in the info.plist from "Fonts provided by application" to "UIAppFonts". Since new projects created with SwiftUI don't include an info.plist file, I suspect that I may have imported some outdated elements from an older plist file. When I tried adding the fonts via the property list UI, it added the "Fonts provided by application" key which seems obsolete and inappropriate for my project. Maybe it helps someone.