XCode7安裝插件VVDocumenter 遇到的問題

本以為在Xcode安裝代碼注釋插件VVDocumenter是一件很輕松的事情,結果卻經歷了一些波折,為了其他人不再為這樣的問題而折騰,決定寫段文字記錄下這個問題的解決過程。

一、到github(https://github.com/onevcat/VVDocumenter-Xcode)下載工程代碼到本地編譯,就會在本地目錄? ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins 下看到VVDocumenter-Xcode.scplugin這樣的文件夾,表示插件安裝到Xcode了。一開始根據網上的某些指引,以為這樣就可以了,但是重新打開Xcode,在菜單Window下面并沒有看到VVDocumenter,在代碼里輸入///也沒有出現期望的注釋效果,說明還沒有成功,請繼續看下面的步驟。

二、由于Xcode7之后蘋果要求加入UUID證書從而保證插件的穩定性。因此Xcode版本更新之后需要在VVDocumenter-Xcode的Info.plist文件中添加Xcode的UUID,辦法如下

1、首先要獲得Xcode的UUID,在終端里執行 defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID 得到的便是Xcode的UUID

2、接著添加Xcode的UUID到VVDocumenter-Xcode的Info.plist文件,步驟如下

(1)打開xcode插件所在的目錄:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins;

(2)選擇已經安裝的插件例如VVDocumenter-Xcode,右鍵”顯示包內容”;

(3)找到info.plist 文件,找到DVTPlugInCompatibilityUUIDs的項目,添加一個Item,Value的值為之前Xcode的UUID,保存。

(4)然后全部關閉Xcode 再重啟Xcode! 到了這一步之后,我又以為這次會成功了,結果還是不行。有人說重啟后會XCode會問你Load bundle還是Skip bundle,這時選擇Load bundle就可以了。

但是我重啟Xcode后并不沒有出現那樣的詢問界面。 后來在github的官方網頁上看到下面的一段:

All plugins will be disabled once you update your Xcode, since the supported UUIDs in the plugins do not contain the one. You should try to clean your plugins folder (~/Library/Application Support/Developer/Shared/Xcode/Plug-ins by default) and clone/build the latest version from master branch. If you happened to skip the bundle loading, you can use this to reset the prompt:

defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-{your_xcode_version}

我的Xcode版本號是7.0.1,于是在終端上輸入defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-7.0.1 重啟Xcode終于看到那個Load bundle 還是Skip bundle的界面,

毫不猶豫地選擇了Load bundle,? 這次果然成功了!

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容