Cocoapods: removing a target leaves broken .xcconfig and .framework file references

Created on 30 Jun 2017  路  9Comments  路  Source: CocoaPods/CocoaPods

Report

What did you do?

  • delete a target for which there were previously configured pods in the Podfile
  • delete the target's block from the Podfile
  • run pod install

What did you expect to happen?

All CocoaPods setup for that target should be cleaned up from the Xcode project.

What happened instead?

  • two references to (now missing) .xcconfig files are left in the Pods group
  • a reference to a (now missing) .framework file is left in the Frameworks group

Here, the ShareExt target was added to the project & Podfile and later removed:

screen shot 2017-06-30 at 15 55 28

Note: if I first remove the target block from the Podfile and run pod install before removing the target from Xcode, the .xcconfig entries are correctly removed. The Pods_ShareExt.framework entry however is still left in the Xcode project:

screen shot 2017-06-30 at 16 00 14

CocoaPods Environment

Stack

   CocoaPods : 1.3.0.beta.2
        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
    RubyGems : 2.6.8
        Host : Mac OS X 10.12.5 (16F73)
       Xcode : 8.3.3 (8E3004b)
         Git : git version 2.11.0 (Apple Git-81)
Ruby lib dir : /Users/kuba/.rvm/rubies/ruby-2.3.3/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 8923943e4910f5a92169ede9332cef619cc195fe

Installation Source

Executable Path: /Users/kuba/.rvm/gems/ruby-2.3.3/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.2.0
cocoapods-try         : 1.1.0

Podfile

target 'RemovingTargetTest' do
  use_frameworks!
  platform :osx, '10.12'

  pod 'CocoaLumberjack'
end

Podfile _before the target was removed_

target 'RemovingTargetTest' do
  use_frameworks!
  platform :osx, '10.12'

  pod 'CocoaLumberjack'
end

target 'ShareExt' do
    use_frameworks!
    platform :osx, '10.12'

    pod 'CocoaLumberjack'
end

Project that demonstrates the issue

https://www.dropbox.com/s/yi0znug6otnq8zc/RemovingTargetTest.zip?dl=0

(git history included)

The test project was done in Xcode 9 beta 2, but I've seen this happening earlier in Xcode 8 too.

easy confirmed defect

Most helpful comment

Does bundle exec pod deintegrate then bundle exec pod install remove them?

All 9 comments

Same thing happens when you have targets grouped under an abstract target (in which case CocoaPods adds a prefix to the file names) and then you remove the abstract targets and move the target definitions to the root. In that case, the prefixed versions of .xcconfig and .framework entries stay in the Xcode project, and unlike the above case, there is no workaround of deleting the target in the Xcode first (since the target isn't deleted at all):

screen shot 2017-07-01 at 08 17 11

Podfile (before)

abstract_target 'Mac' do
  target 'AbstractTargetTest' do
    use_frameworks!
    pod 'CocoaLumberjack'
  end
end

Podfile (after)

target 'AbstractTargetTest' do
  use_frameworks!
  pod 'CocoaLumberjack'
end

Does bundle exec pod deintegrate then bundle exec pod install remove them?

Yup, in both scenarios pod deintegrate removes all .xconfig and .framework entries and pod install recreates only the correct ones.

@dnkoutso I think this might be related to you removing the 0.34 migration or something similar to that?

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

This is still an issue. @segiddins I don't think its related to that change. I can repro it.

@mackuba this is an old issue, I cannot reproduce at the moment anymore. Will try your sample project now.

repro'd and I only get the .framework file remaining, not the xcconfig files.

Was this page helpful?
0 / 5 - 0 ratings