Xcode's plugin greatly enriches the functionality of Xcode and has aAlcatraz, plug-in management is also very easy, like I this vim party completely inseparable fromXvim. But there is a very annoying problem: once you upgrade Xcode, the plugin fails!
Before Xcode upgrade to 6.2 encountered the problem of plug-in failure, Google after a long command to copy to terminal after the run can, at that time a look to solve, suddenly feel satisfied feeling overflowing, oneself can save the Earth ~ No further, the result upgrade to 6.3 when encountered. "The same moves cannot be used on the Holy warrior for the second time!" "The same pit for a moral integrity programmer is not going to fall down to the second time!" So this time must figure out why this is so, and then again encountered how to solve.
Cause of the problem
Xcode's plugin is placed in the directory ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
directory, in the. xcplugin format. With show content you can see that there is a info.plist in Xcplugin, one of which is Dvtplugincompatibilityuuids, and that is why the plugin failed.
Since Apple does not disclose the information about plug-in development, I can only guess the role of dvtplugincompatibilityuuids by naming and value: The plugin uses Dvtplugincompatibilityuuids to specify the version of Xcode that can run this plug-in . As a result, the dvtplugincompatibilityuuids is stored in the Xcode version corresponding to the Uuid,xcode when you start the load control, Matches the current UUID with an array of UUID dvtplugincompatibilityuuids stored in the plug-in info.plist, and if there is no match, the plugin cannot run in that version of Xcode, and the plug-in is invalidated.
Solutions
The workaround is simple: Add the current version of the UUID to Dvtplugincompatibilityuuids. But plug-ins more (one and more) cases, a few open changes are very boring and inefficient, as "lazy" programmer, this time to use the command line, so that repetitive labor automation. The idea is to divide the command into two parts:
find
Find all plug-in info.plist files in the plugin directory by command
xargs
Use the command to "for loop" the search results from the previous step (as you can see), using the command to add the defaults write
current version of the UUID to dvtplugincompatibilityuuids for each info.plist file.
At this point, the problem comes, excavator technology ... No, how do I get the UUID of the current version of Xcode? First turn off Xcode, open terminal, enter tail -f /var/log/system.log
, again open Xcode, you can see the following log information:
[MT] pluginloading:required plug-in compatibility UUID 9F75337B-21B4-4ADC-B558-F9CADF7073A7 for plug-in at path ' ~/Library/ Application Support/developer/shared/xcode/plug-ins/alcatraz.xcplugin ' not present in Dvtplugincompatibilityuuids
As you can see, the log information indicates the reason that Xcode failed to load the plugin and is able to see the current version (6.3) of Xcode's UUID 9F75337B-21B4-4ADC-B558-F9CADF7073A7
. With @kyrrr's reminders, there's a better way to get the UUID of the current version of Xcode: defaults read
read dvtplugincompatibilityuuid from Xcode's info.plist by command.
The final command is:
1 |
Find ~/library/application\ support/developer/shared/xcode/plug-ins-name info.plist-maxdepth 3 | xargs-i{} Defaults write {} dvtplugincompatibilityuuids-array-add ' defaults read/applications/xcode.app/contents/ Info.plist Dvtplugincompatibilityuuid ' |
Running the above command in terminal solves the problem of plug-in failure, and you can see the new UUID in the dvtplugincompatibilityuuids of the plugin info.plist.
The principle and repair method of plugin invalidation after Xcode upgrade