1

enter image description hereI have tried so many solutions out there but finally not getting what to do . I just installed cocoa pods for Alamofire and swiftyJson . And now when i clean and build my project i get an error

NO SUCH FRAMEWORK ALAMOFIRE

when I try import Alamofire in any swift file it says:

NO SUCH MODULE ALAMOFIRE

My Updated Podfile is something like this( No such framework Alamofire error is solved by this pod file). But still getting No such Module alamofire-:

  # Uncomment the next line to define a global platform for your project
platform :ios, ’10.2’


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

target 'ModesTests' do
use_frameworks!
 pod 'Alamofire', '~> 4.4'

  target 'ModesUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

This is how I created Modes.xcworkspace and installed pods and created pod file -:

1) Open Terminal

2) Navigate to the directory containing your ModesSample project by using the cd command:

3) Give the init command

pod init

4)Open the Podfile using command-:

open -a Xcode Podfile

Created pod file is shown above last step is-:

5) pod install

What all I have verified-:

1) I have added Alamofire.framework under path -: Modes->General->Linked Frameworks and Libraries

2) Tried adding Alamofire directory path under-: Build settings->Framework search paths

3) Verified Build Active Architecture Only values it is-:

DEBUG:YES
RELEASE:NO

Can anyone please help me solve this, I have tried 3 times now. Thanks

Tushar Sharma
  • 2,839
  • 1
  • 16
  • 38

4 Answers4

1

Paste the below text in your podfile.

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

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

target 'ModesTests' do
 pod 'Alamofire', '~> 4.4'

  target 'ModesUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

save it. And then run a command "$ pod install" in terminal.(if you had didnt install previously). if you want to update the Alamofire then run command "$ pod update"

Thank you..!!!

Sommm
  • 527
  • 4
  • 22
1

Change your Podfile with the following

# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!


def shared_pods
   pod 'Alamofire'
   pod 'SwiftyJSON'
end
target 'Modes' do
   # Pods for Modes
   shared_pods
end
target 'ModesTests' do
   inherit! :search_paths
   # Pods for testing
   shared_pods

 end

 target 'ModesUITests' do
   inherit! :search_paths
    # Pods for testing
    shared_pods

   end

Do the pod deintegrate and pod install again.

sehaswaran
  • 141
  • 1
  • 8
1

This is what I completely did for ios-10.2 and Xcode -:8.2.1 (This works great)

1) create a project.

2) Go to terminal

3) give command cd desktop(if project on desktop)

4) cd project name

5) pod init(This created pod file in directory)

6) use this pod fie-:

# Uncomment the next line to define a global platform for your project
platform :ios, '10.2'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
def shared_pods
use_frameworks!
   pod 'Alamofire', '~> 4.4'
   pod 'SwiftyJSON'
end
target 'Modes' do
   # Pods for Modes
   shared_pods
end
target 'ModesTests' do
   inherit! :search_paths
   # Pods for testing
   shared_pods

 end

 target 'ModesUITests' do
   inherit! :search_paths
    # Pods for testing
    shared_pods

   end

MARK-: I added use_frameworks under function shared_pods ( That allowed me to use frameworks) don't put it outside it.

7) Save pod file

8) pod install

9) Close Terminal and all open projects .

10) Go to project directory and open Projectname.xcworkspace.

11) First Clean and Build.

12) import Alamofire

13) Bravo use your frameworks.

Tushar Sharma
  • 2,839
  • 1
  • 16
  • 38
0

You need not have to link frameworks (Alamofire or SwiftyJSON) when fetched from pod. All linking is done automatically from pod. You just need to import them.

I tried this for you and it worked. enter image description here

userom
  • 403
  • 5
  • 8
  • so what should i link ?? like-: Pods_Modes.framework something? – Tushar Sharma Apr 06 '17 at 07:10
  • nope. I guess you solved it by deintegrating your pods from project. But still you don't have to do any manual linking of pods. You can do "$pod clean" as well to remove existing workspace and create a fresh. – userom Apr 10 '17 at 06:25
  • nopes pod deintegrate didn't solved it.What actually solved was writing use_framworks under target 'Modes' – Tushar Sharma Apr 11 '17 at 18:10