我从mssql获取.dwg和.pdf文件,其格式为二进制字符串格式。我可以轻松预览或共享pdf文件,但不能使其适用于.dwg文件。至少我需要共享它,因为没有第三方库,预览.dwg文件应该超出范围。
这是我的代码:
let client = SQLClient()
client.connect() {
success in
if success {
client.execute("sql query to get binary string of a file") {
results in
for table in results as Any as! NSArray {
for row in table as! NSArray {
for column in row as! NSDictionary {
self.webView.load((column.value as! NSData) as Data, mimeType: "application/pdf", textEncodingName: "utf-8", baseURL: NSURL() as URL)
self.shareFile = (column.value as! NSData) as Data
}
}
client.disconnect()
}
}
}
}
然后我可以与shareFile
共享activityViewController
,但是在.dwg文件中,它似乎为空。