29

I have an app with a share extension. My app depends on CocoaLumberjack/Default, and my share extension depends on CocoaLumberjack/Core. When I build with use_frameworks!, I get the following error:

$ rm -rf Pods Podfile.lock; pod install
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing CocoaLumberjack (2.0.3)
Generating Pods project

2015-10-28 10:46:04.015 ruby[53095:3440989] warning: The file reference for "CocoaLumberjack.framework" is a member of multiple groups ("Products" and "Products"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.

Integrating client project
Sending stats
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 1 total
pod installed.

[!] [Xcodeproj] Generated duplicate UUIDs:

PBXFileReference -- /mainGroup/children/children:displayName:CocoaLumberjack.framework,explicitFileType:wrapper.framework,includeInIndex:0,isa:PBXFileReference,name:CocoaLumberjack.framework,path:CocoaLumberjack.framework,sourceTree:BUILT_PRODUCTS_DIR,,displayName:CocoaLumberjack.framework,explicitFileType:wrapper.framework,includeInIndex:0,isa:PBXFileReference,name:CocoaLumberjack.framework,path:CocoaLumberjack.framework,sourceTree:BUILT_PRODUCTS_DIR,,displayName:Pods_MyProject.framework,explicitFileType:wrapper.framework,includeInIndex:0,isa:PBXFileReference,name:Pods_MyProject.framework,path:Pods_MyProject.framework,sourceTree:BUILT_PRODUCTS_DIR,,displayName:Pods_MyShare.framework,explicitFileType:wrapper.framework,includeInIndex:0,isa:PBXFileReference,name:Pods_MyShare.framework,path:Pods_MyShare.framework,sourceTree:BUILT_PRODUCTS_DIR,,displayName:Products,isa:PBXGroup,name:Products,sourceTree:,/Products/children/displayName:CocoaLumberjack.framework,explicitFileType:wrapper.framework,includeInIndex:0,isa:PBXFileReference,name:CocoaLumberjack.framework,path:CocoaLumberjack.framework,sourceTree:BUILT_PRODUCTS_DIR,/Products/CocoaLumberjack.framework

This is my Podfile:

workspace 'MyWorkspace'
xcodeproj 'MyProject/MyProject.xcodeproj'

use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

link_with 'MyProject', 'MyShare'

target :MyProject do
  pod 'CocoaLumberjack', '~> 2.0.1'
end

target :MyShare do
  pod 'CocoaLumberjack/Core', '~> 2.0.1'
end

I was able to work around this problem by making both of my targets use the same CocoaLumberjack subspec. My working Podfile is below:

workspace 'MyWorkspace'
xcodeproj 'MyProject/MyProject.xcodeproj'

use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

link_with 'MyProject', 'MyShare'

target :MyProject do
  pod 'CocoaLumberjack/Core', '~> 2.0.1'
end

target :MyShare do
  pod 'CocoaLumberjack/Core', '~> 2.0.1'
end

Why is this workaround necessary? What happens when I actually have different subspec dependencies between two targets?

EDIT

This looks related to CocoaPods Issue 4370. I posted my example project on github.

Heath Borders
  • 30,998
  • 16
  • 147
  • 256

5 Answers5

27

This is a bug in Cocoapods -And probably it won't be fixed in a long while-

Running export COCOAPODS_DISABLE_DETERMINISTIC_UUIDS=YES on the Terminal seems to suppress the warnings for now.

EDIT Feb 2016:

In latest version of Cocoapods this has now been moved to the install section of the Podfile: install! 'cocoapods', :deterministic_uuids => false

  • They claim this was fixed in `1.0.0.beta.4` https://github.com/CocoaPods/CocoaPods/issues/4370#issuecomment-188392490 – Heath Borders Mar 28 '16 at 16:51
  • No, it's not a bug of `cocoapods`. It might be caused by Xcode. I've added [my answer](https://stackoverflow.com/a/60809637/1107242) – DawnSong Mar 23 '20 at 07:47
  • It's probably a mistake made by Xcode when moving files from one folder to another, ref to [my answer](https://stackoverflow.com/a/60809637/1107242) – DawnSong Jul 17 '20 at 12:41
6

It's caused by duplicate files in different directories. Sometimes Xcode might make mistake and duplicate files when you move files to another directory by dragging in Xcode's Project Navigator (press Command + 1 to open). These duplicated files were left orphans and had not been added to the Xcode project, so everything works OK. However, pod install accepted all files in Development Pods including these orphans.

To find these duplicate files, I have two solutions as follows,

Solution 1

find . -path ./.git -prune -o -type f -exec basename {} + | sort | uniq -d

where -path ./.git -prune -o means to exclude .git directory when finding

Solution 2

  1. Copy error messages to a text file named such as duplicateUUIDs.txt
  2. Get sorted file names and output duplicated items
grep -E '[a-zA-Z+]+\.(h|m|swift)' -o duplicateUUIDs.txt | sort | uniq -d

Next Step

Delete unnecessary files.

DawnSong
  • 4,752
  • 2
  • 38
  • 38
  • Not sure, If I follow. It gives me this list: ```at.h awaitable.h context.h endpoint.h error.h executor.h protocol.h reactor.h service.h spawn.h stream.h```. Where do I delete them from? – Houman May 16 '21 at 10:28
  • @Houman Duplicated files must be located in different folders. In order to locate the folder used by your project, open Xcode project navigator, just right click (shift + click) on the file like `at.h`, then choose `Show In Finder`, you will know the correct folder. – DawnSong Aug 05 '21 at 04:50
5

Problem fixed for me by following steps: (I have also done the changes as per @ale0xB suggested)

  1. Clean the project
  2. Close the Xcode
  3. Delete derived data
  4. If you have already installed the POD, kindly delete the “.xcworkspace” & “Podfile.lock” files
  5. Install pod again
  6. Open “.xcworkspace” and Run
Ashvin
  • 8,227
  • 3
  • 36
  • 53
0

I encountered this error when adding an application extension.

I fixed it by repeating the platform :ios, '7.0' line present in my application target to my new target as well.

Making sure the two targets use the same platform solved the issue for me.

ofavre
  • 4,488
  • 2
  • 26
  • 23
-1

write this line in podfile ==> install! 'cocoapods', :deterministic_uuids => false

e.g: platform :ios, '10.0' install! 'cocoapods', :deterministic_uuids => false

target 'WheeboxExamSheetScanner' do config = use_native_modules!