簡體   English   中英

從Swift Cocoa Touch Framework導入JWT

[英]import jwt from swift cocoa touch framework

我正在研究swift cocoa touch framework以從移動應用程序創建可重用框架。

我的框架需要使用https://github.com/vapor/jwt.git jwt項目

我嘗試創建Package.swift ,然后添加.package(url:"https://github.com/vapor/jwt.git", from: "3.0.0") ,然后運行swift package resolve

在我的代碼中,我像這樣導入jwt庫

import JWT
import Foundation

但是我得到了錯誤No such module 'JWT'

我是新手,很快有人可以幫忙嗎?

我的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: "edoc-sdk-swift",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "edoc-sdk-swift",
            targets: ["edoc-sdk-swift"]),
    ],
    dependencies: [
        .package(url:"https://github.com/vapor/jwt.git", from: "3.0.0")
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "edoc-sdk-swift",
            dependencies: ["JWT"]),
        .testTarget(
            name: "edoc-sdk-swiftTests",
            dependencies: ["edoc-sdk-swift"]),
    ]
)

您應該檢查兩件事:

  1. 模塊名稱是JWT而不是jwt
  2. 檢查Package.swift中的.target是否包含"JWT" dependencies

謝謝大家的反饋。

現在我可以解決問題了,我為此博客寫了解決方案

https://piggyman007.blogspot.com/2018/12/create-swift-framework-and-include-some.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM