Consider the following code output when the file doesn’t exist?
import UIKit
let filename:String = "testfile";
var readdata:String = "test data";
let pathname = NSURL(fileURLWithPath: "..") URLByAppendingPathComponent(filename) ;
do {
readdata = try NSString(contentsOfURL: pathname, encoding:NSUTF8StringEncoding) as String } catch { print("read error")
}
print(readdata);
Correct Answer: test data
Explanation:
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
More Swift MCQ Questions