每当Xcode升级之后,都会导致原有的Xcode插件不能使用,这是因为每个插件的Info.plist中记录了该插件兼容的Xcode版本的DVTPlugInCompatibilityUUID,而每个版本的Xcode的DVTPlugInCompatibilityUUID都是不同的。如果想让原来的插件继续工作,我们就得将新版Xcode的DVTPlugInCompatibilityUUID加入到每一个插件的Info文件中,手动添加的话比较费时间还可能出错运行如下脚本可以解决
#!/bin/bash
#PlistBuddy的位置
PLISTBUDDY="/usr/libexec/PlistBuddy"
#获取当前版本Xcode的DVTPlugInCompatibilityUUID
UUID=$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)
echo Xcode DVTPlugInCompatibilityUUID is $UUID
#遍历每一个Xcode插件,将UUID写入插件的兼容列表中
for MyPlugin in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*
do
$PLISTBUDDY -c "Add :DVTPlugInCompatibilityUUIDs: string $UUID" "$MyPlugin"/Contents/Info.plist
echo write DVTPlugInCompatibilityUUID to $MyPlugin succeed!
done
网友评论