My app shares photo on Instagram, to do this it first saves it on a temporary directory:
let writePath = NSTemporaryDirectory().stringByAppendingPathComponent("instagram.igo")
It was working on Swift 1.2
, but does not work on Swift 2.0
.
Given error message is:
stringByAppendingPathComponent is unavailable: use URLByAppendingPathComponent on NSURL instead.
It looks like the method stringByAppendingPathComponent
is removed in Swift 2.0, so what the error message suggests is to use:
let writePath = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("instagram.igo")
Update:
URLByAppendingPathComponent()
has been replaced by appendingPathComponent()
so instead do:
let writePath = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("instagram.igo")