title: Core Text Font Manager failing to register font with certain scope throwing undocumented error code -2
body: <p>I am downloading certain font file and storing it in documents directory. After downloading, I try to register this font file using following code:</p>
  
  <pre><code>@objc func registerAndSetFontTapped(_ sender: UIButton) {
    var error: Unmanaged&lt;CFError&gt;?
    let fontURL = fontsFolder.appendingPathComponent("Muli-Bold.ttf")
  
    if CTFontManagerRegisterFontsForURL(fontURL as CFURL, .user, &amp;error) {
      self.showFontListVC()
    }else if let thisError = error?.takeRetainedValue() {
      print(thisError)
      if let fontError = CTFontManagerError(rawValue: CFErrorGetCode(thisError)) {
        print(fontError.rawValue)
      }
    }
  }
  </code></pre>
  
  <p>This code prints error in console as follows:</p>
  
  <pre><code>Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=-2 "Could not register the font file(s)" UserInfo={NSDescription=Could not register the font file(s), CTFontManagerErrorFontURLs=(
      "file:///Users/rohansanap/Library/Developer/CoreSimulator/Devices/8A875331-5ADB-4DD0-986F-074338F96CC8/data/Containers/Data/Application/035078D5-3E92-4917-99E3-A20A61433F87/Documents/fonts/Muli-Bold.ttf"
  )}
  -2
  </code></pre>
  
  <p>I am getting same error for scope <code>.persistent</code> as well. This above code successfully registers font for only two scope, viz., <code>.none</code> and <code>.process</code>.</p>
  
  <p>Also, I am trying to find what error is this but according to <a href="https://developer.apple.com/documentation/coretext/ctfontmanagererror" rel="nofollow noreferrer">documentation of <code>CTFontManagerError</code></a>, no case corresponds to rawValue <code>-2</code>. What is exactly happening here?</p>
  
  <p>My end goal is to register a font and keep it registered across app launches.</p>