Posts

Post marked as solved
12 Replies
2.6k Views
I'm trying to run ffmpeg from a sandboxed macOS app. ffmpeg itself is installed through homebrew in: /usr/local/bin/ffmpeg which is actually a symlink to: /usr/local/Cellar/ffmpeg/4.3_1/bin/ffmpeg I'm using NSOpenPanel to let the user locate the binary and if I open the symlink I can read the contents of the binary, but I can't execute it. Same if I open the destination file. Here is some sample code: let panel = NSOpenPanel() panel.begin { response in 		guard response == .OK, let url = panel.url else { 				return 		} 		print("> \(url.path)") 		do { 				let data = try Data(contentsOf: url) 				print("> \(data.count) bytes") 				let p = Process() 				p.executableURL = url 				try p.run() 		} catch { 				print("ERROR: \(error.localizedDescription)") 		} } This generates the following output: > /usr/local/Cellar/ffmpeg/4.3_1/bin/ffmpeg > 297536 bytes ERROR: The file “ffmpeg” doesn’t exist.
Posted
by nkeets.
Last updated
.
Post not yet marked as solved
10 Replies
3.5k Views
I'm trying to use QLPreviewPanel with a file stored in Caches, but my app crashes when sandbox is enabled. I've tried different directories instead of Caches but they don't seem to make any difference.Here is a bit more background about what I'm doing: The app is receiving assets in a packed form from the Internet. The assets can be images, text files, documents, etc. After unpacking, each asset is contained in a Data. What I would like to do is present a QuickLook view of this asset to the user. So I don't even need to use the filesystem, I could do it directly from memory if QuickLook supported that.I originally posted this question in a reply to: https://forums.developer.apple.com/message/255625. I'm reposting as a new question in the hope of getting more visibility. Any advice is appreciated.
Posted
by nkeets.
Last updated
.
Post marked as solved
5 Replies
5.8k Views
I'm trying to load a local file to WKWebView and it fails unless I have the com.apple.security.network.client entitlement. Since QuickLook doesn't work either without this entitlement (https://forums.developer.apple.com/thread/115821) is there any way at all to show an HTML file in a sandboxed app that doesn't do outgoing connections?Here is some sample code to showcase this problem:import Cocoa import WebKit class ViewController: NSViewController { var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() self.webView = WKWebView(frame: self.view.frame, configuration: .init()) self.view.addSubview(self.webView) self.webView.loadHTMLString("hello", baseURL: nil) } }
Posted
by nkeets.
Last updated
.