1

I am using CTFontManagerRegisterGraphicsFont to register CGFont loaded at runtime from various sources (files, memory, ..), but some fonts raises an Exception with the following message:

Exception: "*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]"

an alternative to CTFontManagerRegisterGraphicsFont is CTFontManagerRegisterFontsForURL: using this function I did not have any exception raised.

My Questions:

  1. What is the cause of this behavior difference
  2. How to catch & discard the exception raised by CTFontManagerRegisterGraphicsFont
  3. Is there any thing to be done before calling CTFontManagerRegisterGraphicsFont to prevent the exception.
  4. What .persistent scope mean for 2nd parameter in CTFontManagerRegisterFontsForURL.
Ala'a Al Hallaq
  • 455
  • 5
  • 11
  • 2. You can't catch all exception. There is a kind, and I suspect that one of being one that you can't catch https://stackoverflow.com/questions/38737880/uncaught-error-exception-handling-in-swift If you show you code, we might find where the issue is? – Larme Aug 13 '20 at 07:34
  • @Larme the thrown exception is an objective-c exception, and I was able to catch it on the simulator with a helper function, failed to do so on a real device. – Ala'a Al Hallaq Aug 15 '20 at 02:48

0 Answers0