Basically I have a view controller that acts as a setting page. On of the cells calls the "killall backboardd" function to restart the springboard.
However since rewriting my app from objective-c to use swift, I found I have ran into some errors.
The first being that system() command is deprecated. Ok. So it suggest to use posix_spawn API instead. Ok, don't know anything about that, haven't really had a need to research. So I decided to just use NSTask. I use it in the old version a lot so why not this one?
I added the runtime header to the Foundation.framework folder. cleaned project, restarted xcode only to find that I have the warning. "Use of unresolved identifier 'NSTask'
I have the import Foundation so whats with the error? Here is what I'm working with:
let task = NSTask() <----ERROR
task.launchPath = "/usr/bin"
task.arguments = ["killall backboardd"]
let pipe = NSPipe()
task.standardOutput = pipe
task.launch()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
if let output = NSString(data: data, encoding: NSUTF8StringEncoding) {
print(output)
}
task.waitUntilExit()
let status = task.terminationStatus
print(status)
It just seems like the file isnt even linking up how it did in the past. Any help would be greatly appreciated.