I'm trying to display a .log file in a textview but can't seem to access the filepath properly. When I do it returns nil. I'm using a pod called "SwiftyBeaver" to do the logging. This is what the fileURL looks like:
file:///var/mobile/Containers/Data/Application/5C92E3E6-9E45-4869-9142-AB9E70EE4FCC/Library/Caches/swiftybeaver.log
This is the function I'm using to turn the .log into a string so I can display it in a textView
private func loadTextWithFileName(_ fileName: String) -> String? { guard let path = Bundle.main.path(forResource: fileName, ofType: "log"), let contents = try? String(contentsOfFile: path) else {return nil} return contents }
This is how I'm displaying the text to the textView
self.loggingTextView.text = self.loadTextWithFileName(self.file.logFileURL!.absoluteString)