Search code examples
iosswiftnsfilemanager

NSFileManager leads to SourceKit Service Terminated


It's totally confusing on using this line

 var docContents : NSArray! = NSFileManager.defaultManager().contentsOfDirectoryAtPath(archieveDirectoryPath,error: 
 &err)

I get the alert like SourceKit Service Terminated Editor Functionality temporary limited continuously, and gone swift coding style. But When I comment this line, all are disappeared.

Any one experienced this or is this a common error?

Note: I've tried this post's answer, But won't work. Just comment that line, it gets work. But I need that line. I'm using Xcode-6-beta-2


Solution

  • Finally fixed by below code. I think, it may common error. Just replace ! with ? symbol.

    var docContents : NSArray? = NSFileManager.defaultManager().contentsOfDirectoryAtPath(archieveDirectoryPath,error: 
     &err)
    

    But I didn't see any docs related how this happen. If anybody know, let me know. I think, this may temporary workaround.