I update xcode from 6.1 to 6.1.1 and when i try to build my iOS app, it fail.
var url = NSURL.URLWithString("https://my.domain.com")
This line doesn't throw error with xcode 6.1, but since the update, i have to replace by this line:
var url = NSURL(fileURLWithPath: "https://my.domain.com")
Moreover, the request with this URL doesn't work any more.
If someone has any explanations.
Thanks
Looks like apple replaced the factory method URLWithString
with NSURL(string: <#String#>)
, so you should use that insted of fileURLWithPath
Your problem is that:
fileURLWithPath: "Initializes a newly created NSURL referencing the local file or directory at path."
You can still use URLwithString, but try calling it like so: (from documentation)
NSURL *myURL = [NSURL URLWithString:@"https://my.domain.com"];
(objective-c, I realize now you're looking for a Swift answer :)
In Swift:
let urlPath: String = "https://my.domain.com"
var url: NSURL = NSURL(string: urlPath)!