I am trying to add VPX framework that is required for toxav to be compiled. I have my pod spec file like so:
Pod::Spec.new do |s|
s.name = "toxcore-ios"
s.version = "0.1.3"
s.summary = "Cocoapods wrapper for toxcore"
s.homepage = "https://github.com/dvor/toxcore-ios"
s.license = 'GPLv3'
s.author = { "Dmytro Vorobiov" => "d#dvor.me" }
s.source = {
:git => "https://github.com/dvor/toxcore-ios.git",
:tag => s.version.to_s,
:submodules => true
}
s.platform = :ios, '7.0'
s.requires_arc = true
s.source_files = 'toxcore/toxcore/*.{c,h}', 'toxcore/toxencryptsave/*.{c,h}', 'toxcore/toxav/*.{c,h}'
s.public_header_files = 'toxcore/toxcore/*.h', 'toxcore/toxav/*.h'
s.dependency 'libsodium', '~> 1.0.1'
s.dependency 'libopus', '~> 1.1'
s.ios.vendored_frameworks = 'VPX.framework'
s.prepare_command = 'libvpx/build/make/iosbuild.sh'
end
For what it's worth, the prepare_command creates the VPX.framework. I tried adding the VPX.framework files to the s.source_files and s.public_header_files, however they still receive the same error below when running pod lib lint. I'm not even sure if it's necessary to add it to the s.source_files or s.public_header_files since I believe the s.ios.frameworks already takes care of that?
toxcore/toxav/toxav.h:34:10: fatal error: 'vpx/vpx_image.h' file not found
I came across the same issue this week while linking frameworks in my newly created pod. You should use the --use-libraries option while using lint:
pod lib lint --use-libraries
This option is also available while pushing your pod to the master Cocoapods repository or your own repository.
pod repo push REPO_NAME POD_NAME.podspec --use-libraries
Hope this helps!
I figured out my issue. The VPX framework path was listed as below:
VPX.framework/Headers/vpx/{files.h}
When we use vendored_frameworks it actually only looks under the Header folder for the header files. So instead we had this
VPX.framework/Headers/{looks here}
In which case I had to move the files under vpx , to Header
Related
I am trying to include a .framework inside my pod project done in swift.
I have included it in my .podspec using "s.vendored_frameworks" like this:
Pod::Spec.new do |s|
s.name = 'Core'
s.version = '0.1.8'
s.summary = 'This is a pod with a MVVM skeleton that helps to start swiftUI projects'
s.ios.deployment_target = '14.0'
s.swift_versions = '5.2'
s.source_files = 'Core/Classes/**/*'
s.resource_bundles = {
'TGCore' => ['Core/Assets/*']
}
s.vendored_frameworks = 'Core/Frameworks/ScaleBleManagerSDK.framework'
s.resources = "Core/Assets/*"
s.frameworks = 'SwiftUI', 'Foundation'
s.dependency 'Moya', '<= 15.0.0-alpha.1'
end
ScaleBleManagerSDK.framework has been done in objective-c. In my podfile I added
use_frameworks!
So, when I try to use ScaleBleManagerSDK inside my development pod by creating a function I cannot access any of the headers of the framework I did import in the podspec.
What I need to do to access to the headers?
make sure that your headers are put in target -> build phrases -> headers -> public
Maybe I misunderstood the way of s.ios.vendored_frameworks work but I'm trying to use/integrate the Sinch.framework in my own SDK (for the voip part) but in my ReplaceMe.swift I'm not able to import or use any stuff from it
My hierarchy after I used s.ios.vendored_frameworks is the following
My podspec (last version of cocoapods is used)
s.ios.source_files = 'PoCSDK/Classes/**/*','PoCSDK/Frameworks/Sinch.frameworks/Headers/*'
s.ios.vendored_frameworks = 'PoCSDK/Sinch.framework'
s.ios.public_header_files = 'PoCSDK/Frameworks/Sinch.frameworks/Headers/*'
s.resource_bundles = {
'NoddsSDK' => ['PoCSDK/Assets/*']
}
s.frameworks = 'UIKit', 'MapKit', 'AudioToolbox', 'AVFoundation'
s.ios.dependency 'Alamofire', '~> 4.5'
s.ios.dependency 'Socket.IO-Client-Swift'
s.ios.dependency 'ReachabilitySwift'
What I did to add Fabric and Crashlytics to my development pod:
Create Frameworks folder in your Development pod folder
Copy your frameworks to the folder
Update your pod spec
s.vendored_frameworks = 'podname/Frameworks/Fabric.framework', 'podname/Frameworks/Crashlytics.framework'
s.preserve_path = 'podname/Frameworks/*'
Have you checked the real project structure in finder rather than those in Xcode?
Because I put my "Finder" path in vendored_frameworks and all worked for me.
I've successfully compiled a framework using Cocoapods Packager
When attempting to lint the podspec that contains that framework, I'm getting the following error:
ERROR | File Patterns: The spec is empty (no source files, resources, resource_bundles, preserve paths, vendored_libraries, vendored_frameworks, dependencies, nor subspecs).
My podspec is simple and looks like this:
Pod::Spec.new do |s|
s.name = 'MyFramework'
s.module_name = 'MyFramework'
s.version = '0.0.1'
s.summary = 'Summary goes here...'
s.license = 'MIT'
s.homepage = 'http://GITHUB_ACCOUNT.com'
s.frameworks = ["CoreData", "CoreGraphics", "CoreImage", ...more frameworks]
s.requires_arc = true
s.source = {
:git => "https://github.com/GITHUB_ACCOUNT/MyFramework.git",
:tag => s.version.to_s
}
s.ios.platform = :ios, '9.0'
s.ios.preserve_paths = 'MyFramework.embeddedframework/MyFramework.framework'
s.ios.public_header_files = 'MyFramework.embeddedframework/MyFramework.framework/Versions/A/Headers/*.h'
s.ios.vendored_frameworks = 'MyFramework.embeddedframework/MyFramework.framework'
end
The basic format of the podspec is actually generated by Cocoapods-Packager. I've ensured that the following paths in the podspec all point to the expected files:
s.ios.preserve_paths = 'MyFramework.embeddedframework/MyFramework.framework'
s.ios.public_header_files = 'MyFramework.embeddedframework/MyFramework.framework/Versions/A/Headers/*.h'
s.ios.vendored_frameworks = 'MyFramework.embeddedframework/MyFramework.framework'
Running pod spec lint --verbose first tells me that ** BUILD SUCCEEDED **', but then generates the error.
Using the framework in a project via pod update works! But I can't get the pod to lint, so I'll never be able to submit it to the Cocoapods repo.
Note that all of the silly paths in the podspec I've pasted here ('http://GITHUB_ACCOUNT.com') are just placeholders and are valid paths in my actual podspec.
I'm using cocoapods 0.39.0.
Any ideas?
Found out what was wrong here.
s.ios.platform = :ios, '9.0'
means that the linter will build for ALL platforms.
The podspec as created by Cocoapods-Packager initially has this:
s.platform = :ios, '9.0'
s.ios.platform = :ios, '9.0'
At some point I inadvertently deleted the first line, I guess. At any rate, the absence of s.platform tells the linter that you want to test on all platforms.
See valid = spec.available_platforms.send(fail_fast ? :all? : :each) do |platform| here
I never expected to be testing on all platforms, only iOS. It turns out that the linter was failing while testing for watchOS, which I don't care about...
Hopefully this will help someone who makes the same mistake!
I have this Podfile in my project:
platform :ios, '8.0'
use_frameworks!
target 'FunnyApp' do
pod 'Alamofire', '~> 1.2'
pod 'SWXMLHash', '~> 1.0'
pod 'VaultKit', :path => './Frameworks/VaultKit'
pod 'SessionKit', :path => './Frameworks/SessionKit'
end
Only VaultKit is static library written in Objective-C. It has this podspec:
Pod::Spec.new do |s|
s.name = 'VaultKit'
s.version = '0.1'
s.license = 'MIT'
s.summary = 'Encryption library'
s.homepage = 'https://someurl.com'
s.social_media_url = 'http://twitter.com/greenfish29'
s.authors = { 'Tomas Sliz' => 'greenfish29#email.com' }
s.source = { :git => 'git#github.org:greenfish29/vaultkit.git' }
s.ios.deployment_target = '8.0'
s.public_header_files = 'VaultKit/VaultKit.h'
s.source_files = "VaultKit/*.{h,m}" "VaultKit/Models/*.{h,m}"
s.requires_arc = true
end
I have bridging header in my project too with this record:
#import <VaultKit/VaultKit.h>
But when I try to build project, I get this error:
FunnyApp-Bridging-Header.h:5:9: 'VaultKit.h' file not found
What can be wrong?
Cocoapods doesn't support both Frameworks and Static libraries and neither they have an intention to do so.
See the discussion here.
I ended up using Obj-C only libraries for my project by using the bridging header because an important library which I couldn't do without had only an Obj-C version.
I think we may at least get support for dynamic frameworks which use static libraries as dependency in the future.
I'm in the process of writing my very first pod spec, and while I have managed to write a spec that passes validation and pod installĀ seems to install the pod OK the actual source-files are nowhere to be found in my workspace. This is my podfile:
platform :ios, '7.0'
xcodeproj 'NORLabelNodeiOStest'
pod 'NORLabelNode', :path => '~/Programmering/Development/NORLabelNodePodSpec'
pod 'AFNetworking'
As you can see the NORLabelNode pod is installed through a local version of the podspec which looks like this:
Pod::Spec.new do |s|
s.name = "NORLabelNode"
s.version = "0.9.2"
s.summary = "Extension of Apple's SKLabelNode. Allowing multiple lines through the use of \n in the text-string. "
s.description = <<-DESC
Behaves like an ordinary SKLabelNode with the one difference that adding newline characters to the text- property actually adds line-breaks. This is achieved by creating SKLabelNodes as child-nodes, but keeping these as part of the internal (private) logic.
DESC
s.homepage = "https://github.com/nickfalk/NORLabelNode.git"
s.license = 'MIT'
s.author = { "T. Benjamin Larsen" => "benjamin.larsen#noreagle.no" }
s.source = {
:git => "https://github.com/nickfalk/NORLabelNode.git",
:tag => 'v0.9.2'
}
s.social_media_url = 'https://twitter.com/noreagle'
s.platform = :ios, '7.0'
s.ios.deployment_target = '7.0'
s.osx.deployment_target = '10.9'
s.requires_arc = true
s.frameworks = 'SpriteKit'
s.source_files = 'NORLabelNode.{h,m}'
end
Running pod install gives no indication that anything has gone amiss:
Analyzing dependencies
Fetching podspec for `NORLabelNode` from `~/Programmering/Development/NORLabelNodePodSpec`
Downloading dependencies
Installing AFNetworking (2.2.3)
Installing NORLabelNode (0.9.2)
Generating Pods project
Integrating client project
[!] From now on use `NORLabelNodeiOStest.xcworkspace`.
The AFNetworking pod installs the files as expected, but my own NORLabelNode does not. Anyone?
As you can see the NORLabelNode pod is installed through a local version of the podspec which looks like this
That's not how the path option works. It expects a path to the project itself, not the spec.
From the docs:
Using this option CocoaPods will assume the given folder to be the root of the Pod and will link the files directly from there in the Pods project.
If you would like to just use your spec without adding it to the master repo you can create your own repo of specs (docs). Or just place your spec in the correct folder structure in ~/.cocoapods/repos/master