App hangs in simulator
<p><strong>Question</strong></p>

<p>I upgraded my project to Swift 3.0, but after the update the app won't run on the simulator. It doesn't crash, but simply freeze.</p>

<p>I investigated the issue and saw the the apps hangs on the initialisation of the custom fonts.</p>

<p>I copied the function below.</p>

<pre><code>func registerMaterialFont() {
    let url = Bundle.main.url(forResource: "Material-Design-Iconic-Font", withExtension: "otf")!
    let data = try! Data(contentsOf: url)

    let provider = CGDataProvider(data: data as CFData)

    print("Test 1")

    let font = CGFont(provider!)

    print("Test 2")

    var error: Unmanaged&lt;CFError&gt;?
    if !CTFontManagerRegisterGraphicsFont(font, &amp;error) {
        //Error handling here
    } else {
        log.info("Material Font registered");
    }
}
</code></pre>

<p>The console will only print <strong>Test 1</strong>.</p>

<p>Does somebody has an idea whats going on?</p>

<p>NB:. This app is running on a testPhone with sim card and <strong>not running</strong> on an phone without a simcard!</p>

<p><strong>Edit: Stack trace</strong>
If I press pauze in the Debug console, the following stack trace is displayed:</p>

<p><a href="https://i.stack.imgur.com/0aDXA.png" rel="nofollow"><img src="https://i.stack.imgur.com/0aDXA.png" alt="Stack Trace"></a></p>

<pre><code>libsystem_kernel.dylib`semaphore_wait_trap:
    0x10c765fa4 &lt;+0&gt;:  movq   %rcx, %r10
    0x10c765fa7 &lt;+3&gt;:  movl   $0x1000024, %eax          ; imm = 0x1000024 
    0x10c765fac &lt;+8&gt;:  syscall 
-&gt;  0x10c765fae &lt;+10&gt;: retq   
    0x10c765faf &lt;+11&gt;: nop    
</code></pre>