简体   繁体   English

Xcode 8 扩展在编辑器菜单中不可见

[英]Xcode 8 Extension Not Visible In Editor Menu

I have the Xcode 8 GM installed and am trying to mess around with the editor extensions.我安装了 Xcode 8 GM 并且正在尝试使用编辑器扩展。 I've followed the tutorial on this site:我已经按照本网站上的教程进行了操作:

https://littlebitesofcocoa.com/239-creating-an-xcode-source-editor-extension https://littlebitesofcocoa.com/239-creating-an-xcode-source-editor-extension

but for some reason when I run the extension to test it, it doesn't show up in the editor menu at all.但是由于某种原因,当我运行扩展程序来测试它时,它根本没有出现在编辑器菜单中。

Is there something that the tutorial is missing or is there something else I need to do to get the extension to show up in the editor menu?本教程是否缺少某些内容,或者我还需要做些什么才能使扩展程序显示在编辑器菜单中?

Thanks for the help.感谢您的帮助。

I figured it out.我想通了。

By default, the project was not signed.默认情况下,项目未签名。 Clicking on the project and going to the general settings and selecting Enable Development Signing on both the macOS app and the Extension target fixed the issue.单击项目并转到常规设置并在 macOS 应用程序和扩展目标上选择Enable Development Signing修复了该问题。

If you attempt to follow Apple's Create Xcode Extension guide , and then attempt to test your extension , you'll notice that the menu option doesn't show up.如果您尝试遵循Apple 的 Create Xcode Extension guide ,然后尝试测试您的扩展,您会注意到菜单选项没有出现。

If you examine the log, you'll notice it says:如果您检查日志,您会注意到它说:

IDEExtensionManager: Xcode Extension does not incorporate XcodeKit IDEExtensionManager:Xcode 扩展没有包含 XcodeKit

Elise van Looij's solution pointed me in the right direction. Elise van Looij 的解决方案为我指明了正确的方向。

What I had to do was:我必须做的是:

  1. Xcode Extension Target > General tab Xcode 扩展目标 > 常规选项卡

  2. Update XcodeKit.framework to Embed & Sign .XcodeKit.framework更新为Embed & Sign

    By default Apple's template has it as Do Not Embed .默认情况下,Apple 的模板将其设为Do Not Embed Note: You should leave Cocoa.framework as Do Not Embed .注意:您应该将Cocoa.frameworkDo Not Embed

  3. Importantly, you should kill the test instance of Xcode (the one with a black background).重要的是,您应该终止 Xcode 的测试实例(黑色背景)。

    If you don't kill the app, it'll continue to not show up.如果您不杀死该应用程序,它将继续不显示。

  4. You can now run your extension and it'll show up as the last menu option in the Editor menu.您现在可以运行您的扩展程序,它会显示为编辑器菜单中的最后一个菜单选项。

This was tested in Xcode 12.4.这是在 Xcode 12.4 中测试过的。

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

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