MarkdownView
MarkdownView copied to clipboard
Can't load Image on MarkdownView
Hey Guys,
I have a problem with load image. In the screenshot, we can see that the MarkdownView does not load the image, but the image exists on the folder.
Has anyone had the same problem as me? Could someone help me solve this bug, please?
I encountered exactly the same problem, have you found a solution?
I encountered exactly the same problem, have you found a solution?
It's very stranger. In Simulator, it works but on the device not.
A bit late to the party, but I think the issue is WKWebView doesn't have access to your AppData Documents folder by default.
For anyone coming here, it's worth connecting to WKWebView using Safari's web inspector and checking for any error messages on Network or Console.
Did anyone find a solution for displaying local images?
Hey Manuelzi, I didn't remember how I fixed it, but you can see it on the file.
https://github.com/securityfirst/Umbrella_ios/blob/master/Umbrella/ViewControllers/Lesson/MarkdownViewController.swift
Hey Manuelzi, I didn't remember how I fixed it, but you can see it on the file.
https://github.com/securityfirst/Umbrella_ios/blob/master/Umbrella/ViewControllers/Lesson/MarkdownViewController.swift
Thank you, will check it out!
@lucascorrea Got it working with MarkdownView. Just had to remove "file://" from the URL encoded string. Thanks again!
let imageElement: String = Bundle.main.path(forResource: "<FILENAME>", ofType: "png").map {
let imageUrl = URL(fileURLWithPath: $0).absoluteString.replacingOccurrences(of: "file://", with: "")
return ")"
} ?? ""