-1

Just to reiterate:
I have installed PodFile
Opened the Xcode.workspace
Updated Xcode to 10.13.6
Installed Alamofire on the Terminal by both CocoaPods and manually

Still 'No such module'.

Currently at a beginner level, very beginner level, so if there's a glaring omission I have made don't hesitate to let me know, please.

This is to provide some context. Currently when I try to run the build (weather app) for the following code (among many ofc)

import UIKit
import Alamofire
import SwiftyJSON
import NVActivityIndicatorView
import CoreLocation

The following result comes:

No such module 'Alamofire'

I expected the build to be complete and the design to show on the iPhone screen interface, but what I received were 6 errors.

1 in ViewController

Swift Compiler Error /Users/geralt/Desktop/weather/weather/ViewController.swift:11:8: No such module 'Alamofire'

5 in the Workspace

Error :-1: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Alamofire macOS')

:-1: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Alamofire iOS')

:-1: unexpected duplicate task: CodeSign /Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework (in target 'weather')

:-1: Multiple commands produce '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework': 1) Target 'weather' has copy command from '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/Alamofire.framework' to '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework' 2) Target 'weather' has copy command from '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug/Alamofire.framework' to '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework'

:-1: Multiple commands produce '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework/Alamofire': 1) Target 'weather' has copy command from '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/Alamofire.framework' to '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework' 2) Target 'weather' has copy command from '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug/Alamofire.framework' to '/Users/geralt/Library/Developer/Xcode/DerivedData/weather-djqzudchmqdcjmaidcjeenpqymbn/Build/Products/Debug-iphonesimulator/weather.app/Frameworks/Alamofire.framework'

This is a straight copy and paste of the errors so apologies in advance if this appears long-winded.

I have attempted changing the SWIFT and AlamoFire to be compatible. It's getting pretty frustrating because I am still getting this Build Fail.

Does anybody have any alternative suggestions that they can please help me with?

D-A
  • 1
  • 2
  • 1
    What do you mean `by both CocoaPods and manually` ? can you show us the podfile? The process should be `add pod in podfile`, run `pod install` in terminal, then open `workspace`. and import the framework. – AjinkyaSharma Aug 29 '19 at 09:55
  • Sure, the podfile is as: pod 'Alamofire', '~> 5.0.0-beta.5' pod 'SwiftyJSON', '~ 4.0' pod 'NVActivityIndicatorView' pod 'AFNetworking', '0.9.1' – D-A Aug 29 '19 at 19:31
  • did you run `pod install`? did it complete successfully? – Cristik Sep 05 '19 at 19:49
  • Thanks for helping. I ran it, after doing 'cd' and the weather app directory. It came with a lot of things but one thing stood out to me: ### Podfile ```ruby # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'weather' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for weather pod 'Alamofire', '~> 4' pod 'SwiftyJSON', '~ 4.2' pod 'NVActivityIndicatorView' pod 'AFNetworking', '0.9.1' 1/2 – D-A Sep 05 '19 at 22:46
  • target 'weatherTests' do inherit! :search_paths # Pods for testing end target 'weatherUITests' do inherit! :search_paths # Pods for testing end end ``` ### Error ``` ArgumentError - Illformed requirement `"~ 4.2"` 2/2 – D-A Sep 05 '19 at 22:47

2 Answers2

0

add Alamofire.framework to Linked Frameworks and Libraries

mouli
  • 21
  • 5
  • Thank you, but it appears I already have when I checked Linked Frameworks and Libraries. Any other things I might have missed? – D-A Aug 29 '19 at 19:18
0

Mate, no need to change in the pod file what is wrong here is your Alamofire is specified to SWIFT 5.0 and its not supported in your IDE so for that what you need to do is change the Swift Language Version.

First click on - Pods icon then you will see all your frameworks there then click on Alamofire. After that you will see Build Setting. As you see in this image enter image description here

Now search 'swift' in search field change the swift version clean and build your code. There you go

Hope it will work.

Abhishek
  • 329
  • 3
  • 12
  • Thanks for clarifying and showing a screenshot of this. I've changed it to Swift 4.2 (there was Swift 4 and Swift 3 too but I changed it to 4.2). I assume this change is what you mean by 'change the swift version clean'. Built the code again and it still showed 'No such module Alamofire'. By the way, on the Podfile is as shows: pod 'Alamofire', '~> 5.0.0-beta.5' pod 'SwiftyJSON', '~ 4.0' pod 'NVActivityIndicatorView' pod 'AFNetworking', '0.9.1' – D-A Aug 29 '19 at 19:29
  • Alamofire 5 requires Swift 5. If you need to use Swift 4(.2), use Alamofire 4. Also, don't use AFNetworking, especially not 0.9. – Jon Shier Aug 29 '19 at 20:02
  • Thank you I've changed the Swift and Alamo to be corresponding numbers; took away the AFNetworking and still a build fail. – D-A Aug 31 '19 at 22:27