1

So I created a cocoa-pod and successfully added a font to it. When I run pod install in the consuming project, it pulls in the fonts. I'm even able to use the fonts in the storyboard. However when I try to access the font either directly in the consuming project or in the pod via UIFont(name: "my-fonts-name", size: 20)! the font initializer returns nil.

The font is ".ttf" file extension.

I have done the following:

  • The font is in my pod's file structure and finder structure.
  • My font has its pod listed as a target member.
  • My fonts are in build phases -> Bundle Resources.
  • My font name/s are in my plist.

I also tried running:

    UIFont.familyNames.forEach({ familyName in
        let fontNames = UIFont.fontNames(forFamilyName: familyName)
        print(familyName, fontNames)
    })

and nothing resembling my custom font was not printed.

I am then getting "The file “PPUIElementModules91.framework” couldn’t be opened because you don’t have permission to view it." I don't have permission to access the very pod I created. I have gone through all the answers here one by one but none worked.

  • The font name and the name of the ttf file are rarely the same. – rmaddy May 24 '18 at 00:51
  • See https://stackoverflow.com/questions/15984937/adding-custom-fonts-to-ios-app-finding-their-real-names and look at the last couple of answers for Swift code. – rmaddy May 24 '18 at 00:54
  • Thank you @rmaddy, I have already tried printing out all the available fonts and my font is not listed...-Even though it IS available in the storyboard of the pod consuming project. Will update my question. – ScottyBlades May 24 '18 at 04:13
  • To clarify, nothing resembling my custom font's name was listed either. – user9661174 May 24 '18 at 05:24

0 Answers0