这个问题podspec
与供应商框架use_frameworks!
和pod file
我Podspec
为我的框架创建了一个(其中包含swift
和obj-c
代码)。上述pod spec
是针对vendor framework
已经编译为 iOS 的(即封闭源代码)embedded framework
,它本身包含 swift 和 Objective-c 代码(“混合项目”)。
该框架有一个伞头,并定义了一个module
并在直接嵌入到项目时按预期工作(手动没有pod,拖放到项目中)并使用托管应用程序中的语法:
#import <MyFramework/Myframework.h>
框架标题具有标准行:
//! Project version number for MyFramework.
FOUNDATION_EXPORT double MyFrameworkVersionNumber;
//! Project version string for MyFramework.
FOUNDATION_EXPORT const unsigned char MyFrameworkVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <MyFramework/PublicHeader.h>
#import <MyFramework/Header_one.h>
#import <MyFramework/Header_two.h>
... etc.
我正在尝试的相应 pod-spec(以及其中的许多组合......)
Pod::Spec.new do |s|
s.name = "MyFramework"
s.version = "1.0.0"
s.summary = "MyFramework SDK."
s.description = "Some sort of long description of the pod"
s.homepage = "http://MyFramework.com/"
s.license = { :type => "Commercial", :text => "MyFramework Copyright 2015 ...." }
s.author = { "Avner Barr" => "avner@abc.com" }
s.platform = :ios, "8.0"
s.source = { :http => "http://somewhere_over_the_rainbow/MyFramework.zip" }
s.public_header_files = "MyFramework.framework/Headers/*.h"
s.module_map = "MyFramework.framework/Modules/module.modulemap"
s.preserve_paths = "InsertFramework.framework/*"
s.vendored_frameworks = "MyFramework.framework"
s.requires_arc = true
end
在宿主应用程序的 pod 文件中:
source '.../.../MyPrivateTestingPodSpecRepo.git'
use_frameworks!
target 'TestPSpec1' do
pod 'MyFramework'
end
pod 会按预期下载并创建工作区,但在尝试执行以下操作时会使用 swift 代码:
import MyFramework
我得到错误:
Include of non-modular header inside framework module 'MyFramework'
在objective-c标头(<>
语法)中出现“红色”错误。
IE
MyFramework.h
#import <MyFramework/Header_one.h> Include of non-modular header inside framework module 'MyFramework'