Twilio: No such module `Alarmofire` when trying to get started

梦想与她 提交于 2019-12-25 00:37:55

问题


Im trying to learn the ropes of Twilio. The goal is to send text messages from my app. Im following this getting started guide

At the last step is to run this command in terminal: (yes I have changed SwiftSMSwith my own project name)

swift build && ./.build/debug/SwiftSMS    

This command results in the following:

MyMac:MyProject MyName$ swift build && ./.build/debug/myProject Compile Swift Module 'myProject' (1 sources) /Volumes/myProject/myProject/Sources/myProject/main.swift:2:8: error: no such module 'Alamofire'
import Alamofire

^ error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Volumes/myProject/myProject/.build/debug.yaml main output:

I have not done any config with Twilio in Xcode yet. As far as I can understand from the guide should this send a message without doing anything in Xcode?

EDIT*:
Package.swift:

    // swift-tools-version:4.2
    // The swift-tools-version declares the minimum version of Swift required to build this package.

 import PackageDescription

let package = Package(
    name: "myProject",
    dependencies: [
        .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.0")
    ],
    targets: [
        .target(
            name: "myProject",
            dependencies: ["Alamofire"]),
        .testTarget(
            name: "myProjectTests",
            dependencies: ["Alamofire"]),
        ]
)

回答1:


Use this as your Package.swift - you can't simply say "Alamofire" and expect SPM to magically know where to get the sources from.

import PackageDescription

let package = Package(
    name: "myProject",
    dependencies: [
        .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.0")
    ],
    targets: [
        .target(
            name: "myProject",
            dependencies: ["Alamofire"]),
        .testTarget(
            name: "myProject Tests",
            dependencies: ["Alamofire"]),
        ]
)


来源:https://stackoverflow.com/questions/54079000/twilio-no-such-module-alarmofire-when-trying-to-get-started

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!