gpt4 book ai didi

ios - 从 swift cocoa touch 框架导入 jwt

转载 作者:行者123 更新时间:2023-11-30 10:59:04 36 4
gpt4 key购买 nike

我正在研究swift cocoa touch framework从移动应用程序创建可重用的框架。

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

我尝试创建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'

我是 swift 的新手,有人可以帮忙吗?

我的 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, not jwt .
  2. 检查 Package.swift 中的 .target 是否在 dependency 中包含 "JWT"

关于ios - 从 swift cocoa touch 框架导入 jwt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53610849/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com