I'm using cocoapods 1.2.1
I made this podspec:
Pod::Spec.new do |s|
s.name = "SignalLib"
s.version = "2.3.1"
s.summary = "Signal Protocol Pod."
s.description = <<-DESC
This allows an iOS project to retrieve and configure the Signal C implementation
https://github.com/WhisperSystems/libsignal-protocol-c
DESC
s.homepage = "http://www.pangea.com"
s.license = { :type => 'GPLv3', :text => <<-LICENSE
Copyright 2015-2016 Open Whisper Systems
Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
Additional Permissions For Submission to Apple App Store: Provided that you are otherwise in compliance with the GPLv3 for each covered work you convey (including without limitation making the Corresponding Source available in compliance with Section 6 of the GPLv3), Open Whisper Systems also grants you the additional permission to convey through the Apple App Store non-source executable versions of the Program as incorporated into each applicable covered work as Executable Versions only under the Mozilla Public License version 2.0 (https://www.mozilla.org/en-US/MPL/2.0/).
LICENSE
}
s.author = { "XXX" => "XXX#XXX.com" }
s.osx.deployment_target = '10.9'
s.ios.deployment_target = '8.0'
s.source = { :git => "https://github.com/WhisperSystems/libsignal-protocol-c.git",
:tag => 'v' + s.version.to_s}
s.header_mappings_dir = 'src'
s.source_files = ["src/**/*.{h,c}"]
s.exclude_files = 'src/curve25519/ed25519/main'
s.public_header_files = ["src/signal_protocol.h", "src/signal_protocol_internal.h", "src/LocalStorageProtocol.pb-c.h", "src/signal_protocol_types.h", "src/curve.h", "src/hkdf.h", "src/ratchet.h", "src/protocol.h", "src/session_state.h", "src/session_record.h", "src/session_pre_key.h", "src/session_builder.h", "src/session_cipher.h", "src/key_helper.h", "src/sender_key.h", "src/sender_key_state.h", "src/sender_key_record.h", "src/group_session_builder.h", "src/group_cipher.h", "src/fingerprint.h"]
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/SignalLib/src $(PODS_ROOT)/SignalLib/src/curve25519 $(PODS_ROOT)/SignalLib/src/curve25519/ed25519', 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
#s.preserve_paths = 'src'
s.subspec 'protobuf-c' do |ss|
ss.source_files = 'src/protobuf-c/protobuf-c.h', 'src/protobuf-c'
ss.public_header_files = 'src/protobuf-c/protobuf-c.h'
#ss.preserve_paths = 'src/protobuf-c'
ss.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/SignalLib/src/protobuf-c' }
#ss.frameworks = 'frameworks'
end
end
This ALMOST works but in some files there is a:
#import <protobuf-c/protobuf-c.h>
And that fails when Xcode tries to compile it.
The reason is that even if I make a subspec supposed to include the file protobuf-c.h , the file is not in the subspec folder.
I tried using
s.header_mappings_dir = 'src'
But that also fails. It's actually even worse because the s.public_header_files doesn't even work anymore and only my umbrella header is included as public.
Related
I am trying to install a library through local podspec. This is how my podspec looks like
Pod::Spec.new do |s|
s.name = 'MI_SDK_DEVELOPMENT'
s.version = '1.0.0'
s.license = { :type => 'Unspecified' }
s.homepage = 'https://www.modirum.com'
s.authors = { 'Modirum Ou' => 'info#modirum.com' }
s.summary = 'Modirum 3DS SDK iOS framework (Development)'
s.platform = :ios
s.source = { :path => './LocalPods/MI_SDK_DEVELOPMENT.framework.zip' }
s.ios.deployment_target = '8.0'
s.ios.vendored_frameworks = 'MI_SDK_DEVELOPMENT.framework'
end
when I run the pod install pods installed successfully but it does not copy the 'MI_SDK_DEVELOPMENT.framework' in the XCode project. So I am having the following error
So don't know is there something wrong with the Pod itself or I am missing something in the installation. Any help will be highly appreciated. Thanks
EDIT:
Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
target 'ModirumSDKExample' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ModirumSDKExample
pod 'MI_SDK_DEVELOPMENT', :path => './LocalPods/MI_SDK_DEVELOPMENT.podspec'
end
By the Cocoapods Documentation, it seems that .zip files are only unarchivable via http resources:
Using HTTP to download a compressed file of the code. It supports zip, tgz, bz2, txz and tar.
So this would work:
s.source = { :http => 'https://example.com/MI_SDK_DEVELOPMENT.framework.zip' }
This would not:
s.source = { :path => './LocalPods/MI_SDK_DEVELOPMENT.framework.zip' }
I am trying to write a PodSpec that allows us to use one framework JellyFrameworkForDefice.framework when installing to a device and another framework JellyFrameworkForSimulator.framework when installing to a simulator via Xcode. Does anyone have any ideas around this or have examples they have seen where this has worked before?
Pod::Spec.new do |s|
s.name = 'Jelly'
s.module_name = 'Jelly'
s.version = '1.0.3'
s.summary = 'Jelly 4.1.2'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/<GITHUB_USERNAME>/Jelly'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '' => '' }
s.source = { :git => 'https://github.com/<GITHUB_USERNAME>/Jelly', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'Jelly/Classes/**/*.h', 'Jelly/Classes/**/*.m', 'Jelly/Classes/**/*.mm'
s.resources = 'Jelly/Assets/UX_Resources/*', 'Jelly/Classes/UX/Resources/*'
s.libraries = 'c++'
s.vendored_framework = 'Jelly/Libraries/JellyFrameworkForDefice.framework', 'Jelly/Libraries/JellyFrameworkForSimulator.framework'
s.dependency 'Cordova', '4.2.1'
s.dependency 'DependencyContainer'
s.dependency 'JellyService'
s.compiler_flags = '-lstdc++', '-lc++'
s.ios.framework = 'AudioToolbox', 'AVFoundation', 'CoreGraphics',
'CoreMedia', 'CoreVideo', 'MobileCoreServices', 'OpenGLES',
'QuartzCore', 'Security', 'ImageIO', 'Foundation', 'UIKit'
s.xcconfig = { 'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited) -framework "JellyFrameworkForSimulator"',
'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -framework "JellyFrameworkForDefice"' }
end
I am trying to find out a way to declare dependency from subspec 'B' to subspec 'A' in the podspec: 'mypodspecfile.podspec' as below:
Pod::Spec.new do |s|
s.name = "MyLib-SDK"
s.version = "1.0"
s.summary = "My Library"
s.homepage = "http://myhomepage.com"
s.ios.deployment_target = "8.0"
s.ios.frameworks = "Foundation", "UIKit", "SystemConfiguration", "Security", "CoreTelephony", "WebKit"
s.source = { :git => "https://github.com/myhome/ios-project.git", :tag => "1.0" }
s.subspec 'MyLibrary-A' do |libOne|
libOne.source_files = "Headers", "Headers/**/*.h"
libOne.exclude_files = "Headers/Exclude"
libOne.resources = "SharedAssets/*"
libOne.libraries = "z","sqlite3" #Zlib for gzip, sqlite3 for event store
libOne.vendored_library = "libMyLibrary_A.a"
end
s.subspec 'MyLibrary-B' do |libTwo|
libTwo.source_files = "Headers", "Headers/**/*.h"
libTwo.exclude_files = "Headers/Exclude"
libTwo.resources = "SharedAssets/*"
libTwo.dependency 'MyLibrary-A' <-- doesn't seem to be working here!!
libTwo.libraries = "sqlite3" # sqlite3 for db
libTwo.vendored_library = "libMyLibrary_B.a"
end
end
When I execute:
$pod spec lint mypodspecfile.podspec --verbose
-ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for MyLibrary-A depended upon by MyLibrary-B
Any help would be greatly appreciated. Thanks you!
You should always write the full path to the pod dependencies. The error states that cocoa pods cannot find the .podspec file for MyLibrary-A in the pod repo(s). To fix the issue, specify full path 'MyLib-SDK/MyLibrary-A'.
So your podspec file should look like this:
Pod::Spec.new do |s|
s.name = "MyLib-SDK"
s.version = "1.0"
s.summary = "My Library"
s.homepage = "http://myhomepage.com"
s.ios.deployment_target = "8.0"
s.ios.frameworks = "Foundation", "UIKit", "SystemConfiguration", "Security", "CoreTelephony", "WebKit"
s.source = { :git => "https://github.com/myhome/ios-project.git", :tag => "#{s.version}" }
s.subspec 'MyLibrary-A' do |libOne|
libOne.source_files = "Headers", "Headers/**/*.h"
libOne.exclude_files = "Headers/Exclude"
libOne.resources = "SharedAssets/*"
libOne.libraries = "z","sqlite3" #Zlib for gzip, sqlite3 for event store
libOne.vendored_library = "libMyLibrary_A.a"
end
s.subspec 'MyLibrary-B' do |libTwo|
libTwo.source_files = "Headers", "Headers/**/*.h"
libTwo.exclude_files = "Headers/Exclude"
libTwo.resources = "SharedAssets/*"
libTwo.dependency 'MyLib-SDK/MyLibrary-A' # here is the change
libTwo.libraries = "sqlite3" # sqlite3 for db
libTwo.vendored_library = "libMyLibrary_B.a"
end
end
I have a "CocoaPod" (terminology?) that's currently at version 1.1.
There's also a develop branch of the repo that requires Swift 2.0 (so needs a base SDK of IOS 9.0) with a PodSpec as follows:
Pod::Spec.new do |s|
s.name = 'ReachabilitySwift'
s.version = '2.0-beta1'
s.homepage = 'https://github.com/ashleymills/Reachability.swift'
s.authors = {
'Ashley Mills' => 'ashleymills#mac.com'
}
s.summary = 'Replacement for Apple\'s Reachability re-written in Swift with callbacks.'
s.license = { :type => 'MIT' }
# Source Info
s.ios.platform = :ios, "9.0"
s.osx.platform = :osx, "10.11"
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.9"
s.source = {
:git => 'https://github.com/ashleymills/Reachability.swift.git',
:branch => 'develop',
:tag => 'v'+s.version.to_s
}
s.source_files = 'Reachability.swift'
s.framework = 'SystemConfiguration'
s.requires_arc = true
end
The PodSpec fails to validate (pod spec lint) as it builds using Xcode 8.3. How do I force it to use the latest Xcode-beta?
You can easily change the Command-Line tools version in the Xcode Preferences "Locations" tab, and change "Command Line Tools" to Xcode 7.0.
This should do the trick with "pod lib lint".
For example, I have project A, and it need project B, so I use pod "Project B". But project B need some dylib and static library. So, I write project B podspec such as:
Pod::Spec.new do |s|
s.name = 'ProjectB'
s.version = '3.0.0'
s.license = 'MIT'
s.summary = 'ProjectB'
s.homepage = 'urlAddress'
s.authors = { 'Jumei' => 'app#jumei.com' }
s.source = { :git => 'gitAddress', :branch => 'develop'}
s.vendored_library = 'ProjectB_Dir/libmp3lame.a'
s.library = 'libc++.dylib'
s.requires_arc = true
s.ios.deployment_target = '5.0'
end
but thers is not libc++.dylib in project B.
Please run pod spec lint on specs as you write them. We've removed the need for you to include lib and .dylib from included libraries. So in this case you should just use:
s.library = 'c++'