【问题标题】:CommonCrypto for Framework in podspecpodspec 中的 CommonCrypto for Framework
【发布时间】:2018-04-25 12:14:50
【问题描述】:

我对如何让这个 podspec 工作感到很生气。

我正在开发一个 swift 框架,需要 CommonCrypto。经过许多问题使其适用于每个团队(Cordova,React),这就是 CommonCrypto 的实现方式:

我在构建阶段获得了一个带有运行脚本的聚合目标 CommonCryptoModuleMap:

if [ -d "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap" ]; then
echo "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap directory already exists, so skipping the rest of the script."
exit 0
fi

mkdir -p "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap"
cat <<EOF > "${BUILT_PRODUCTS_DIR}/CommonCryptoModuleMap/module.modulemap"
module CommonCrypto [system] {
    header "${SDKROOT}/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}
EOF

但现在,我们的目标是将其实现为 Swift 中另一个框架的依赖项。所以我必须在 podspec 中指定目标依赖。

我从 Xcode 构建或归档它没有问题。

这是我的 Podspec:

Pod::Spec.new do |s|
  s.name               = "AFrameworkHasNoName"
  s.version            = "0.1.5"
  s.summary            = "Foo bar"
  s.homepage           = "https://github.com/MyRepository_ios"
  s.license            = "License"
  s.author             = { "Veesla" => "valentin.cousien@gmail.com" }
  s.source             = { :git => "git@github.com:MyRepository_ios.git", :tag => "develop" }
  s.swift_version      = "4.0"
  s.platform           = :ios, "8.0"
  s.requires_arc       = true
  s.exclude_files      = "AFrameworkHasNoNameTests/*"
  s.source_files       = "AFrameworkHasNoName/**/*.{h,m,swift}"
  s.module_name        = "AFrameworkHasNoName"
end

这是错误:

- WARN  | source: The version should be included in the Git tag.
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - WARN  | url: The URL (https://github.com/MyRepository_ios) is not reachable.
    - WARN  | [iOS] license: Unable to find a license file
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR | [iOS] xcodebuild:  MyFileImportingCommonCrypto.swift:10:8: error: no such module 'CommonCrypto'

感谢您的回复

【问题讨论】:

标签: swift cocoa cocoapods podspec commoncrypto


【解决方案1】:

没关系,似乎我不是唯一一个未能在另一个 SDK 中包含的 SDK 中包含 CommonCrypto 的人。

我只是通过包含 CryptoSwift(仅使用纯 Swift)来绕过这个问题。它非常适合我。它有点重,但你不必处理模块映射文件和 C 库......很容易使用,很好的实现

这里是 CryptoSwift 的链接:https://github.com/krzyzanowskim/CryptoSwift

希望对你们有帮助!

PS:谁能解释一下为什么我被否决了? :(

【讨论】:

    猜你喜欢
    • 2012-12-15
    • 1970-01-01
    • 1970-01-01
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    • 2016-04-18
    相关资源
    最近更新 更多