這個問題是與在pod file
如何正確地創建一個可可豆莢規範的供應商框架
供應商框架和use_frameworks!
問候podspec
我創建了一個Podspec
我的框架(其中包含swift
和obj-c
代碼)。 前面提到的pod spec
適用於vendor framework
(即封閉源代碼),該代碼已被編譯爲iOS embedded framework
,該代碼本身包含swift和objective-c代碼(「混合項目」)。
該框架有一個傘頭和限定module
和按預期工作時直接嵌入到一個項目(手動而不莢,拖和下降到項目)和在主機應用程序中使用的語法:
#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.
相應的,我想莢規格(和許多COM binations存在的...)
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" => "[email protected]" }
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
在主機應用程序的莢文件:
source '.../.../MyPrivateTestingPodSpecRepo.git'
use_frameworks!
target 'TestPSpec1' do
pod 'MyFramework'
end
莢下載並創建預期的工作空間,但在SWIFT代碼試圖做的時候:
import MyFramework
我得到的錯誤:
Include of non-modular header inside framework module 'MyFramework'
在objective-c標頭(<>
語法)中出現「紅色」錯誤。
即
MyFramework.h
#import <MyFramework/Header_one.h> Include of non-modular header inside framework module 'MyFramework'