10

I have custom frameworks in my app bundle for WebKit, WebCore, and JavaScriptCore. I would like all other frameworks that depend on the system versions of WebKit, WebCore, or JavaScriptCore to use my custom versions also. For instance my custom version of Webkit loads private system frameworks that in turn depend on the system version of WebKit. This means both my WebKit and the system WebKit get loaded, and usually a crash happens shortly after.

The way I understand this should be done, is to set the DYLD_FRAMEWORK_PATH environmental variable before your app bundle begins execution (Search order for loading frameworks can be found here: http://code.google.com/p/macdependency/wiki/SearchPaths). You can set environmental variables in code with setenv, but it won't take effect for the currently running process. I would have to re-launch the process again for it to take effect. I would like to avoid this too.

So my question is what is the best way to set the DYLD_FRAMEWORK_PATH before the execution of the my app bundle? This has to work in a release app bundle too. Is there a way to run a script whenever someone clicks on my app bundle before the executable starts running. Or is there any other suggestions out there?

Thanks in advance.

4

4 回答 4

2

Jeff Wolski的想法是正确的,他直接参考了 Apple 关于该主题的文档。该线程还就如何在 Xcode 中实现这一点提供了极好的建议,包括与替代规范方法相关的极端情况(例如,~/.bash_profile直接为您的用户使用)。

我插话的原因是您要求提供一个可以帮助您的脚本(赏金提供者似乎也有同样的问题)。事实证明,Webkit在其文档中引用了这样一个脚本,您可能希望将其从适用的 Webkit 源代码中挑选出来。这应该会给你额外的指导,至少根据开发人员的说法,你应该如何正确地做到这一点。

祝你的项目好运。

于 2012-04-08T00:11:05.480 回答
1

我会推荐environment.plistLSEnvironment. info.plist查看下面的链接。

https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

于 2012-04-06T21:09:13.443 回答
0

WebKit 目前有一个脚本可以为您执行此操作,称为 run-webkit-app。请参阅http://trac.webkit.org/browser/trunk/Tools/Scripts/run-webkit-app

于 2015-01-06T02:41:08.093 回答
0

较新版本的 ld 理解该-dyld_env标志,它将LC_DYLD_ENVIRONMENT加载命令插入二进制文件(因此基本上在应用程序执行中尽可能早地应用)。也许添加-Wl,-dyld_env,DYLD_FRAMEWORK_PATH=/folder/encosing/WebKit/and/related/frameworks到你的编译器标志可能会做你想要的?

于 2020-08-19T05:23:45.020 回答