4

I have inserted SDWebImage to the Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'NSData+Base64', '~> 1.0'
pod 'Facebook-iOS-SDK', '~> 3.23'
pod 'CrashlyticsFramework', '~> 2.2'
pod 'AFNetworking', '~> 2.5'
pod 'NewRelicAgent', '~> 4.186'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
pod 'Reachability', '~> 3.2'
pod 'SDWebImage', '~> 3.7'

followed by:

pod install
pod update

It is all succesfuly installed.

But when I open the workspace and try to access the library I get this upon importing #import <SDWebImage/UIImageView+WebCache.h>

TNCViewController.m:12:9: 'SDWebImage/UIImageView+WebCache.h' file not found

Under Pods project I can see Pods/SDWebImage

and I have added manually ImageIO.framework to Linked Frameworks and Libraries.

What else can I do? Never experienced such problem with a cocoapod library before.

Update I have found the problem !!

If I remove the Target Membership for the Unit tests, then it compiles !! This also happened on a fresh project where I copied the files over.

This means the Pod install doesn't install the files for the test target. Any idea what I could do please?

Houman
  • 64,245
  • 87
  • 278
  • 460
  • Try deleting all the pods and podlock file, and re installing them again. – Jassi Mar 29 '15 at 12:39
  • Thanks, I just tried it. It doesn't help. – Houman Mar 29 '15 at 12:49
  • Remove the version 3.7 and then update the pod again. It will install a latest version of pod. Hope that might help – Jassi Mar 29 '15 at 12:52
  • I just tried it. No change as it was already `3.7.2`. – Houman Mar 29 '15 at 12:59
  • This is totally weird as i am using it in one of my project. – Jassi Mar 29 '15 at 13:03
  • I just created a new project and it works. Darn. I don't know what else I could do. I deleted the `Pods` folder and `Podfile.lock`, what else can I do, to reset the whole state? – Houman Mar 29 '15 at 13:27
  • I hope other libraries are not conflicting any where with SdWebImage. Have you added all the libraries in the new folder? – Jassi Mar 29 '15 at 13:34
  • Sorry for the mistake, I mean in a new project not folder – Jassi Mar 29 '15 at 13:59
  • I have started a new project with all the cocodspods. No conflict. All works. I even used https://github.com/kylef/cocoapods-deintegrate to remove cocoapads from my former project and reinstalled everything. I removed the derived data and rebuilt. No chance. Instead of coding I am cocoa poding for 1.5 hours. I am now porting everything to the new project. Wasted so much time :( – Houman Mar 29 '15 at 14:12
  • I can understand. I have also wasted hours sometimes. Sorry i couldn't able to help you – Jassi Mar 29 '15 at 14:23
  • @Jassi I found the problem. Please have a look at the updated question. – Houman Mar 29 '15 at 15:35
  • For test target it wont show an error if you import I guess. If it shows an error you can add it in Pod file so it will install for test target. Check and let me know. – Jassi Mar 29 '15 at 16:06

1 Answers1

4

I finally found the solution !!

I instaled first Cocoa Pods deintegrate: https://github.com/kylef/cocoapods-deintegrate

pod deintegrate
rm Podfile.lock
rm Podfile
pod init
vim Podfile

-> My Pod file now looks like this:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'News' do

pod 'NSData+Base64', '~> 1.0'
pod 'Facebook-iOS-SDK', '~> 3.23'
pod 'CrashlyticsFramework', '~> 2.2'
pod 'AFNetworking', '~> 2.5'
pod 'NewRelicAgent', '~> 4.186'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
pod 'Reachability', '~> 3.2'
pod 'SDWebImage', '~> 3.7'

end

target 'NewsTests' do

pod 'SDWebImage', '~> 3.7'

end

Now it works. The reason is that if you mark your ViewController to become part of the Test Target, you also need the library in the Test Target.

I should have ran pod init in first place. It is not that optional as the documentation claims it to be.

Hope this helps others and save them hours of frustration

Houman
  • 64,245
  • 87
  • 278
  • 460