简体   繁体   English

可可沙盒应用程序:产生FFMPEG

[英]Cocoa Sandbox App: Spawn FFMPEG

I have an application which uses FFMPEG and FFPROBE to perform some tasks on a video the user can open with my application. 我有一个使用FFMPEG和FFPROBE的应用程序,可以对用户可以通过我的应用程序打开的视频执行某些任务。

For non-sandboxed applications everything works fine, but when my app is running in a sandbox FFPROBE doesn't seem to get started. 对于非沙盒应用程序,一切正常,但是当我的应用程序在沙盒中运行时,FFPROBE似乎无法启动。 The Console says the following: 控制台显示以下内容:

08.06.15 12:27:55,803 secinitd[281]: ffprobe[4049]: registration request failed: (0x11, 0x0) Container object initialization failed. 08.06.15 12:27:55,803 secinitd [281]:ffprobe [4049]:注册请求失败:(0x11,0x0)容器对象初始化失败。 failed to get bundleid for app "/Users/Alex/.../ffprobe" 无法获取应用程序“ /Users/Alex/.../ffprobe”的bundleid

The path to ffprobe mentioned in this messages points to the MacOS directory within the app bundle (a Build Phase copies these two binaries into the executable directory). 此消息中提到的ffprobe路径指向应用程序捆绑包中的MacOS目录(“构建阶段”将这两个二进制文件复制到可执行目录中)。

I've searched a lot and found some hints regarding entitlements. 我进行了很多搜索,发现了一些有关权利的提示。 Of course my sandboxed app has its entitlements and when building my application it gets signed (with --deep signing flag). 当然,我的沙盒应用程序具有其应享权利,并且在构建我的应用程序时会对其进行签名(带有--deep signing标志)。 It even passes the technical App Store check for entitlements. 它甚至可以通过技术性App Store的权利检查。

Now I'm stuck and wonder why my application is not able to launch FFPROBE (and FFMPEG). 现在,我陷入了困境,想知道为什么我的应用程序无法启动FFPROBE(和FFMPEG)。

Does anybody have a clue? 有人知道吗?

It seems like I've found a solution. 看来我已经找到了解决方案。 I don't know whether all of these steps are necessary, but here is what I've tried and what seems (!) to work: 我不知道所有这些步骤是否都是必需的,但是这是我尝试过的以及似乎可以工作的(!):

  1. I added an entitlements file which contains true for the keys com.apple.security.inherit and com.apple.security.app-sandbox 我添加了一个权利文件,其中包含对com.apple.security.inheritcom.apple.security.app-sandbox密钥的true
  2. I added a plist file for each used binary and filled the keys CFBundleName and CFBundleIdentifier with suitable values (I don't know whether this step is necessary) 我为每个使用的二进制文件添加了一个plist文件,并用适当的值填充了键CFBundleNameCFBundleIdentifier (我不知道此步骤是否必要)
  3. I added a Run Script build phase which executes codesign -f -s "your certificate" --entitlements ./ffmpeg.entitlements ./Build/Intermediates/ArchiveIntermediates/App\\ Store/InstallationBuildProductsLocation/Applications/<my app>/Contents/MacOS/ffmpeg for each binary used. 我添加了一个Run Script构建阶段,该阶段执行codesign -f -s "your certificate" --entitlements ./ffmpeg.entitlements ./Build/Intermediates/ArchiveIntermediates/App\\ Store/InstallationBuildProductsLocation/Applications/<my app>/Contents/MacOS/ffmpeg用于每个使用的二进制文件。

These steps result in suitable entitlements when trying to submit the app to the Mac App Store and it results in a correct usage of the embedded binaries (at least on my development Mac and the Mac of some colleagues). 当尝试将应用程序提交到Mac App Store时,这些步骤会产生适当的权利,并且可以正确使用嵌入式二进制文件(至少在我使用的Mac和某些同事的Mac上)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM