18

I have a iOS project with a cocoa touch framework where I'd like to use CocoaPods. Everything runs and behaves correctly, as far as I can tell, but I'm getting the following warning for all the pods included (here with the example of MagicalRecord.

objc[56961]: Class MagicalRecord is implemented in both /Users/stefan/Library/Developer/Xcode/DerivedData/FrameworkPlayground-ecdubsjzkmacfihjxoxvlznqvgmg/Build/Products/Debug-iphonesimulator/SharedDataSource.framework/SharedDataSource and /Users/stefan/Library/Developer/CoreSimulator/Devices/41B1BE94-1242-4538-8D60-23BAC3337308/data/Containers/Bundle/Application/B8ADA4E6-02BC-4095-8A14-D254C13D0928/FrameworkPlayground.app/FrameworkPlayground. One of the two will be used. Which one is undefined.
objc[56961]: Class PodsDummy_Pods_MagicalRecord is implemented in both /Users/stefan/Library/Developer/Xcode/DerivedData/FrameworkPlayground-ecdubsjzkmacfihjxoxvlznqvgmg/Build/Products/Debug-iphonesimulator/SharedDataSource.framework/SharedDataSource and /Users/stefan/Library/Developer/CoreSimulator/Devices/41B1BE94-1242-4538-8D60-23BAC3337308/data/Containers/Bundle/Application/B8ADA4E6-02BC-4095-8A14-D254C13D0928/FrameworkPlayground.app/FrameworkPlayground. One of the two will be used. Which one is undefined.

I uploaded the Xcode project to github, it's available here: https://github.com/haemi/FrameworkWithCocoaPods

Here two pictures from the current setup:

enter image description here

enter image description here

swalkner
  • 16,679
  • 31
  • 123
  • 210

4 Answers4

4

Change your pods file from:

target 'App' do
   # all your pods
end

target 'AppTests' do
   # all your pods
end

to:

target 'App' do
    # all your pods

    target 'AppTests' do
        inherit! :search_paths
    end
end
zalogatomek
  • 666
  • 1
  • 9
  • 19
1

You must be opening your project with Xcode project but you should open your project with Xcode Workspace which is created by cocoa pods.

The project is not including the Pods file because of which those frameworks are not included and are shown in red Color.

Opening your project through workspace would resolve your issue.

Updated :

  1. Just change the Setting to remove the error that used to come :

enter image description here

  1. Change the Setting to :

enter image description here

  1. It would resolve the previous error but it would generate new errors of PODS to remove the error just remove Check Pods manifest.lock and copy pods resources.

enter image description here

  1. Just Delete MyHelper.h and MyHelper.m file.

  2. Add new MyHelper class but this time change the target to FrameworkPlayground and put the same content which was there before and import #import into MyHelper.h file.

enter image description here

Dheeraj Singh
  • 5,143
  • 25
  • 33
  • At my end i tried your code from xcode proj ,got same error as yours. But when opened through workspace no error is shown and build is successful. – Dheeraj Singh Mar 30 '15 at 08:44
  • 1
    do you get any warnings when running the app? – swalkner Mar 30 '15 at 09:17
  • yes, i got it. what are you trying with "SharedDataSource" can u tell ? – Dheeraj Singh Mar 30 '15 at 09:21
  • 1
    in my real project I'm using WatchKit and need to have Core Data; to have access to my data storage in one place, I'm using app groups together with the framework (= SharedDataSource) – swalkner Mar 30 '15 at 11:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/74091/discussion-between-dheeraj-singh-and-swalkner). – Dheeraj Singh Mar 30 '15 at 11:41
1

Had the same issue. Solved it by deleting the derived data for my project. Go to Window -> Projects, select your project, and then click the "Delete" button to the right of the Derived Data section. Go back to your Xcode window and clean the build folder using command+option+shift+k. Then go to your simulator, iOS Simulator -> Reset Content and Settings. Return to your Xcode window, build your project and run. This only works for those having issued with derived data.

Eric Hou
  • 341
  • 3
  • 9
0

First followed this answer to purge my derived data but when recompiling I got a compilation error. Eventually ended up getting the fix from this answer. Basically, the culprit seems to be that the Pods are linked twice under Other Linker flags in your project's settings.

Community
  • 1
  • 1
Stunner
  • 12,025
  • 12
  • 86
  • 145