Search code examples
fileswiftnsdataswift-playground

NSData(contentsOfFile: "someexistingfile") returns nil in Playground


Is there a good reason that above returns nil in Playground? When run in AppDelegate the statements returns the file contents, but in Playground it's nil. Is it just another silly bug from Apple? Or just me not finding the docu which states that this is not allowed?


Solution

  • It turned out that Playground was simply unwilling. Booo, Apple. I used the command

    rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
    

    to get it going once again. A receipt I learned somewhere else on SO. This also cures a lot of other unwillingnesses of XCode.