Post

Replies

Boosts

Views

Activity

Use of QLPreviewPanel in a sandboxed app
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.
10
0
3.7k
Apr ’19
Running ffmpeg from a sandbox
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.
12
0
3.2k
Jul ’20