2

I have an Apple Watch extension named "watchTest". I am trying to add Alamofire for this extension, but without success until now.

My Podfile:

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

platform :ios, '9.3'

use_frameworks!

target 'buttonExample' do
    pod 'Alamofire'
end

target 'watchTest' do
    pod 'Alamofire'

    target 'watchTest Extension' do
        inherit! :search_paths
    end

end

Pod Install Log (the warning could be the source of the problem):

Analyzing dependencies
Downloading dependencies
Using Alamofire (4.9.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] The `watchTest [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-watchTest/Pods-watchTest.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `watchTest [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-watchTest/Pods-watchTest.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

WatchTest Extension InterfaceController.swift:

import WatchKit
import Foundation
import Alamofire

class InterfaceController: WKInterfaceController {

    override func awake(withContext context: Any?) {
        super.awake(withContext: context)

        // Configure interface objects here.
    }

    override func willActivate() {
        // This method is called when watch view controller is about to be visible to user
        super.willActivate()
    }

    override func didDeactivate() {
        // This method is called when watch view controller is no longer visible
        super.didDeactivate()
    }

}

Error on compiling:

watchTest Extension: No such module 'Alamofire'

alxlives
  • 5,084
  • 4
  • 28
  • 50

2 Answers2

11

Please check out this link. It shows that you must add platform :watchos 'version' to the target.

target 'watchTest Extension' do
    platform :watchos, 'version'
    pod 'Alamofire'
end
eirikvaa
  • 1,070
  • 1
  • 13
  • 24
0

Add pod under extension target not anywhere else

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

platform :ios, '9.3'

use_frameworks!

target 'buttonExample' do
    pod 'Alamofire'
end

target 'watchTest' do
    pod 'Alamofire'

    target 'watchTest Extension' do
        inherit! :search_paths
        pod ‘Alamofire’
    end
end
eirikvaa
  • 1,070
  • 1
  • 13
  • 24
Zahid Nazir
  • 136
  • 1
  • 5