在 MacRuby 中加载私有框架
我正在尝试遵循本教程 “揭秘 Leopard 上的 Mail.app 插件” 构建 Mail.app 插件。我尝试使用 MacRuby,而不是使用 PyObjC。我已经加载了 MacRuby 0.6,并且已经完成教程中的这一步(PyObjC 代码):
MVMailBundle = objc.lookUpClass('MVMailBundle')
我在网上搜索了一下,但似乎找不到有关加载私有框架“MVMailBundle”的任何信息麦克鲁比。有什么想法吗?
提前致谢 - AYAL
I'm attempting to follow this tutorial 'Demystifying Mail.app Plugins on Leopard' to build a Mail.app plugin. Instead of using PyObjC I'm trying to use MacRuby. I've got MacRuby 0.6 loaded up and I've gotten to this step in the tutorial (PyObjC code):
MVMailBundle = objc.lookUpClass('MVMailBundle')
I've search the web a bit but can't seem to find any information about loading the private framework 'MVMailBundle' in MacRuby. Any ideas?
Thanks in advance - AYAL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这个插件将被加载到 Mail.app 中,它已经加载了相关的私有框架。所以我们只想在运行时查找一个类(这就是 Python 代码片段正在做的事情——而不是加载框架)。在 MacRuby 中执行此操作的方法是 MVMailBundle = NSClassFromString 'MVMailBundle'。
(您需要包含
framework 'Cocoa'
才能获取 NSClassFromString 方法,但我假设您已经这样做了。)I think the idea is that this plugin will be loaded into Mail.app, which will already have loaded the private framework in question. So we just want to look up a class at runtime (which is what that Python snippet is doing — not loading a framework). The way to do this in MacRuby is
MVMailBundle = NSClassFromString 'MVMailBundle'
.(You will need to include
framework 'Cocoa'
in order to get the NSClassFromString method, but I assume you'll have already done this.)MacRuby 使用垃圾收集,而 Mail 则不使用。您无法将 GC 包加载到非 GC 应用程序中。所以这是一个死胡同。
MacRuby uses garbage collection and Mail doesn't. You can't load a GC bundle into a non-GC app. So this is a dead-end.