花了好几个小时后,我绝对需要你的帮助 .

我想创建一个包含Spotify SDK(here,它是 .framework )和Deezer SDK(here,它是 *.a lib )的pod,以便进行一些工作 .

这两个SDK都是用 Objective-C 编写的,我想在 Swift 2(iOS 8)中编写我的pod . 此外,包含此pod的项目也在Swift 2(iOS 8)中 .

使用 pod create lib 创建pod项目后,我开始尝试直接在pod项目中添加 Spotify.framework ,但无法编译...

所以,我尝试通过编写podspec来将Spotify.framework包含在pod中,这里是 spotify.podspec.json

{
  "name": "FakeSpotify",
  "version": "1.1",
  "summary": "Spotify iOS SDK",
  "homepage": "https://developer.spotify.com/technologies/spotify-ios-sdk/",
  "license": "MIT",
  "authors": {
    "jjt": "jeanjaques@thierry.com"
  },
  "source": {
    "git": "https://github.com/spotify/ios-sdk.git",
    "tag": "beta-13"
  },
  "platforms": {
    "ios": "8.0"
  },
  "requires_arc": true,
  "preserve_paths": "Spotify.framework",
  "public_header_files": "Spotify.framework/Versions/A/Headers/*.h",
  "vendored_frameworks": "Spotify.framework",
  "xcconfig": {
    "OTHER_LDFLAGS": "-ObjC"
  }
}

而且我还在 Podfile 上添加了一行:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'SpoTest_Example', :exclusive => true do
  pod 'SpoTest', :path => '../'
  pod 'FakeSpotify', :podspec => './spotify.podspec.json'
end

target 'SpoTest_Tests', :exclusive => true do
  pod 'SpoTest', :path => '../'
end

现在,在 pod install 之后,创建了一个文件夹"FakeSpotify",其中包含Spotify.framework . 这部分还可以,但是_1439839使用它...

我既不能在示例项目中导入Spotify,也不能在开发pod文件中导入Spotify(都在Swift中) .

我试图在伞文件(SpoTest-umbrella.h)中添加 #import <Spotify/Spotify.framework ,但是出现了错误: Include of non-modular header inside framework module 'SpoTest' .

在点击自己和一些搜索之后,我尝试通过添加此帖子脚本来编辑我的podfile:

post_install do |installer|
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
        configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
end

没有更好的,同样的错误 . 好的,我该怎么办?嗯,我试图删除以前在伞文件中添加的导入,我编辑了我的pod podspec(SpoTest.podspec) . 我哭了“哦,我真的很糟糕,我们还需要告诉我们这个podspec有一个依赖,即使是开发测试...” .

所以我添加了这条美丽的线条: s.dependency 'FakeSpotify'

我很高兴,......太伤心了: pod install 命令的新错误现在:

[!] The 'Pods-SpoTest_Example' target has transitive dependencies that include static binaries: (/Users/jjt/Documents/dev/ios/LIBS/SpoTest/Example/Pods/FakeSpotify/Spotify.framework)

哎哟,太近了!好吧,让我们试着解决它 . 我通过添加预安装脚本编辑了我的Podfile:

pre_install do |installer|
    # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
    def installer.verify_no_static_framework_transitive_dependencies; end
end

这样,命令行就可以了,安装就完成了 . 但我仍然无法使用它 . 如果我在伞中导入框架,仍然会出现错误 .

你还有什么想法吗?我目前没有更多:)

或者也许没有cocoapods有更好的方法?我的目标是使用这两个SDK创建一个东西,并将其轻松地包含在其他实际项目中 .

谢谢 .