Difficulty reading UserDefaults with Fastlane Snapshot
<p>I'm using <a href="https://github.com/fastlane/fastlane" rel="nofollow">Fastlane's</a> <a href="https://github.com/fastlane/fastlane/tree/master/snapshot" rel="nofollow"><code>snapshot</code></a> to create screenshots for an app I'm about to submit to the App Store.</p>

<p>It works "as advertised" for the most part, but it doesn't seem to like the way I access the <code>UserDefaults</code> within my app. On one test, it generates an <strong>Exit status: 65</strong> error.</p>

<p><code>UI Testing Failure - com.me.MyApp crashed in (extension in MyApp):__ObjC.NSObject.defaultTime () -&gt; Swift.Float</code></p>

<p>I find <code>UserDefaults.standard.value(forKey: "defaultTime")</code> to an invitation for a syntax error, so I created an extension to access <code>UserDefaults</code>. Here's what the extension looks like:</p>

<pre><code>class CustomExtensions: NSObject {
    /*
     This is blank. Nothing else in here. No really...nothing else
     */
}

extension NSObject {
    // User Defaults    
    func defaultTime() -&gt; Float {
        return UserDefaults.standard.value(forKey: "defaultTime") as! Float
    }

    // a bunch of other UserDefaults    
}
</code></pre>

<p>Wihin the app, whenever I need <code>defaultTime</code>, I just type <code>defaultTime()</code>. Using this method to access <code>UserDefaults</code> values works fine in the Simulator and on the devices I've tested. I only encounter a problem with <code>snapshot</code>.</p>

<p>I've tried adding in <code>sleep(1)</code> within the test, but that doesn't seem to do anything. I welcome suggestions re: alternative means of accessing <code>UserDefaults</code> that enable me to access them easily throughout MyApp.</p>