3

This question is already asked here But no answers work for me. I have tried all the ways which are mentioned below.

  1. Open project using .xcworkspace
  2. Deleted all the pod related file from project and again pod install even updated the cocoa pods.
  3. Added $(inherited) flag in Other Linker Flags. and -ObjC also, so it may find path from pod framework.
  4. Added bridging file to import SDWebImage.
  5. Deep clean, build every time and restart the project.

I am checking all scenario since 4 to 5 hours but I am not getting the exact reason why this is happening.

Below is my Pod file.

platform :ios, '12.0'
use_frameworks!
target 'ProjectName' do
     pod 'Alamofire'
     pod 'SDWebImage'
end

enter image description here

Manish
  • 608
  • 1
  • 11
  • 23

4 Answers4

9

SDWebImage is a Swift pod depending on Objective-C, which is different than Alamofire, and needs one extra step:

  • For CocoaPods 1.5.0+ (and Xcode 9+):
    Add :modular_headers => true to the line of package name, like:
# For CocoaPods after 1.5.0
target 'ProjectName' do
  pod 'Alamofire'
  pod 'SDWebImage', :modular_headers => true
end
  • For earlier versions:
    Add or uncomment use_frameworks! in the Podfile, like
# For CocoaPods before 1.5.0
target 'ProjectName' do
  use_frameworks!
  pod 'Alamofire'
  pod 'SDWebImage'
end

Finally, to apply the change, please

  1. Close Xcode
  2. Run pod update in the project folder
  3. Open the .xcworkspace file in Xcode again.

Reference:
SDWebImage Installation Guide
CocoaPods 1.5.0 — Swift Static Libraries

Myles
  • 454
  • 1
  • 6
  • 12
  • 1
    Holy shit you absolute LEGEND...using :modular_headers was the key for me, after a day and a half of struggle. Thank you SO much! – Nick Coelius May 03 '21 at 17:47
4

This happened to me many times try these steps:

-> Try cleaning your project

OR

-> Restart your Xcode

OR

-> If you doing a new project setup than try again new project again

  1. delete your workspace
  2. again create your new workspace with pods installing from fresh
  3. try to rebuild

3rd option could work as this happens many times when search paths are not getting in build settings of your project

karan
  • 3,319
  • 1
  • 35
  • 44
  • I have tried to created new project as you mentioned in 3rd option. Now all works fine. Thanks you so much. – Manish Feb 14 '19 at 07:20
1

Start Fresh

  1. Open terminal
  2. Drag Path Of your Project
  3. Create Podfile add the required dependencies
  4. pod install
  5. Open Workspace
  6. Locate SDWebImage.framework in products including support files
  7. DO Show in Finder for SDWebImage.framework. copy the framework and use it any where
Nishant Pathania
  • 349
  • 1
  • 14
0

This worked for me:

go to your workspace's Edit Scheme > Build > select check both Build Options.

Make sure "Find Implicit Dependencies" is checked.

Celine
  • 31
  • 4