我的代码加载在TextView的本地RTF文件加载RTF,但怎么做我使其适用于位于在线如何使用URL,而不是本地
文件,因为它不工作时,我使用的URL 这里网址 - http://howtotechworld.com/rtfdoc.rtf
这里是代码
if let rtf = NSBundle.mainBundle().URLForResource("http://howtotechworld.com/rtfdoc", withExtension: "rtf", subdirectory: nil, localization: nil) {
do {
let attributedString = try NSAttributedString(fileURL: rtf, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType], documentAttributes: nil)
textView.attributedText = attributedString
textView.editable = false
print(attributedString)
}
catch _ {
NSLog("catched a error");
}
@LeoDabus对不起你什么意思我试图做到这一点上使用RTF文件服务器而不是本地文件 –