After spending hours, I definitely need your help.
I want to create a pod including Spotify SDK (here, it's a .framework) and Deezer SDK (here, it's a *.a lib) in order to do some work with.
Both SDK are written in Objective-C, and I want to write my pod in Swift 2 (iOS 8). Also, projects that will include this pod are in Swift 2 (iOS 8).
After the creation of the pod project with pod create lib
I started by trying to add Spotify.framework directly in the pod project, but can't compile...
So, I tried to include the Spotify.framework like a pod by writing a podspec, here is 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"
}
}
And I Also added a line on the 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
Now, after a pod install
, a folder "FakeSpotify" is created with the the Spotify.framework in it. This part is ok, but it's not enough : I can't use it...
I can't import Spotify neither in the example project, nor in the development pods files (both in Swift).
I tried to add #import <Spotify/Spotify.framework
in the umbrella file (SpoTest-umbrella.h), but there were an error : Include of non-modular header inside framework module 'SpoTest'
.
After hitting myself and some search, I tried to edit my podfile by adding this post script :
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
Nothing better, same error. Ok ok, what can I do ? Hmmm, I tried to remove the previously added import in umbrella file and I edited my pod podspec (SpoTest.podspec). I cried "ohhh I'm really bad, we need to also tell that we have a dependency in this podspec, even for development test...".
So I added this beautiful line : s.dependency 'FakeSpotify'
I was so happy, ... and so sad : new error from pod install
command now :
[!] The 'Pods-SpoTest_Example' target has transitive dependencies that include static binaries: (/Users/jjt/Documents/dev/ios/LIBS/SpoTest/Example/Pods/FakeSpotify/Spotify.framework)
Ouch, so close ! Ok, let's try something to deal with it. I edited my Podfile by adding a pre install script :
pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
def installer.verify_no_static_framework_transitive_dependencies; end
end
With this, the command line is ok, and the installation is done. But I still can't use it. And there is still an error if I import the framework in umbrella.
Do you have any more ideas ? I currently don't have more :)
Or maybe there is a better way without cocoapods ? My goal is to create a something with these two SDK, and to include it easily on others reals projects.
Thanks.