The principle and repair method of plugin invalidation after Xcode upgrade

Source: Internet
Author: User

Reprint: Http://joeshang.github.io/2015/04/10/fix-xcode-upgrade-plugin-invalid/

Xcode plugin greatly enriched the function of Xcode, and with Alcatraz, plug-in management is very easy, such as I this Vim party completely inseparable from Xvim. 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 in the ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins . 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 information about plug-in development, here I can only guess the role of dvtplugincompatibilityuuids by naming with value: plug-ins through Dvtplugincompatibilityuuids To specify the version of Xcode that can run this plug-in . Therefore, the dvtplugincompatibilityuuids is stored in the Xcode version corresponding to Uuid,xcode when the loading control is launched, the current UUID with the plug-in info.plist The dvtplugincompatibilityuuids stored in the UUID array to match, if there is no match, indicating that the plug-in cannot run in this version of Xcode, the plug-in will be 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:

    1. The find info.plist file for all plugins is found in the plugin directory by command.
    2. xargsUse 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 . After @Kyrrr reminders, there is a better way to get the UUID of the current version of Xcode: defaults read read dvtplugincompatibilityuuid from the info.plist of Xcode 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.