Skip to content

Instantly share code, notes, and snippets.

@pouriaalmassi
Last active May 16, 2016 03:11
Show Gist options
  • Save pouriaalmassi/90d62bec751bdb3d61a93a7c46744ce7 to your computer and use it in GitHub Desktop.
Save pouriaalmassi/90d62bec751bdb3d61a93a7c46744ce7 to your computer and use it in GitHub Desktop.
// Swift 2.2
// Xcode Version 7.3 (7D175)
// 1
do {
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil)
} catch {
var dict = [String: AnyObject]()
// Build warning:
// Forced cast from 'ErrorType' to 'NSError' always succeeds; did you mean to use 'as'?
dict[NSUnderlyingErrorKey] = error as! NSError
let wrappedError = NSError(domain: "error-domain", code: 0001, userInfo: dict)
}
// 2
do {
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil)
} catch {
var dict = [String: AnyObject]()
// Build error:
// 'ErrorType' is not convertible to 'NSError'; did you mean to use 'as!' to force downcast?
dict[NSUnderlyingErrorKey] = error as NSError
let wrappedError = NSError(domain: "error-domain", code: 0001, userInfo: dict)
}
@yanni-fe
Copy link

Hi there, I run into this problem yesterday, but I cannot resolve it. I reinstall my Xcode, but with no lucky. Did you find out why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment