【发布时间】:2020-03-14 07:20:23
【问题描述】:
我有使用插件开发的项目。因此,要添加任何新功能,我们会在开发和测试后创建新插件将其添加到主项目。每个插件都有自己的 podfile 和 podspec。所以我想将 quantumgraph pod 添加到我的一个名为 I GraphIntegrationPlugin 的插件中。
以下是我的 GraphIntegrationPlugin 的 podspec:
Pod::Spec.new do |s|
s.name = "GraphIntegrationPlugin"
s.version = '0.1.1'
s.summary = "GraphIntegrationPlugin plugin.
DESC
s.homepage = "https://abc:8fqTzT2v7UXAwu6RE6CV@bitbucket.org/GraphIntegrationPlugin-ios.git"
s.license = 'MIT'
s.author = { "Aabc dd” => “abc@gmail.com" }
s.source = { :git => "https://abc:8fqTzT2v7UXAwu6RE6CV@bitbucket.org/GraphIntegrationPlugin-ios.git", :tag => s.version.to_s }
s.ios.deployment_target = "10.0"
s.platform = :ios, '10.0'
s.requires_arc = true
s.swift_version = '5.1'
s.frameworks = 'UserNotifications', 'UIKit', 'Foundation', 'UserNotificationsUI'
s.source_files = 'PluginClasses/**/*.{swift,h,m}'
s.resources = 'Resources/**/*.{storyboard,xib,xcassets,png,plist}'
s.public_header_files = 'Pods/**/**/*.h'
# Public frameworks
s.dependency 'quantumgraph'
s.xcconfig = {
'OTHER_LDFLAGS' => '-objc -ObjC',
'OTHER_CFLAGS' => '-fembed-bitcode',
'ENABLE_BITCODE' => 'YES',
'SWIFT_VERSION' => '5.1',
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**',
'LIBRARY_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**',
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/Headers/Public'
}
end
编译包含这个GraphIntegrationPlugin的主项目后,生成以下项目目录结构:
MainProject:
- support files
- Resources
- Classes, etc.
Pod:
- Pods
--quantumgraph
- iOS-sdk
- QGSdk.h
- QGInbox.h
- Frameworks
- libQGSdk.a
- Support Files
- quantumgraph.xcconfig
--GraphIntegrationPlugin
-xyz.swift
-support files
- GraphIntegrationPlugin.modulempa
- GraphIntegrationPlugin.xcconfig
- GraphIntegrationPlugin.dummy.m
- GraphIntegrationPlugin-Info.plist
- GraphIntegrationPlugin.prefix.pch
- GraphIntegrationPlugin.umbrella.h
成功生成项目后,当我尝试将 import QGSdk 添加到 xyz.swift 时,它会抛出找不到模块的错误。为了解决这个问题,我手动更改了 GraphIntegrationPlugin 的构建设置。
- 我将 libQGSdk.a 添加到 Framework 中,并在 GraphIntegrationPlugin Target 的 General 中链接库。
- 在 GraphIntegrationPlugin.umbrella.h 我添加了#import QGSdk.h
- 我将 QGSdk.h 添加到 GraphIntegrationPlugin 目标中,并且 Target Membership 将其公开。
在此之后,错误消失了,我可以将 QGSdk 的所有方法和变量访问到我的 xyz.swift。
但不幸的是,我无法将构建设置的手动更改推送到 Git,或者我们的架构不支持这一点。因此,我想通过 podspec 进行以上三个手动构建设置更改。我尝试了所有可能的解决方案来编写 podspec,使其应该按照我的预期方式配置 GraphIntegrationPlugin 的构建设置,但无法做到这一点。
我需要对 podspec 进行哪些更改以使 QGSdk.h 标头在我的 GraphIntegrationPlugin 的 Swift 类中可用?我有这个链接BJ Homer,但它没有满足我创建 podspec 的要求。
【问题讨论】:
标签: ios swift cocoapods podspec build-settings