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.
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
I've set up a workspace with two Swift projects in it: one a framework I'm developing, the other a demo app for the framework.
Podfile looks like this:
platform :ios, '9.0'
workspace 'foo.xcworkspace'
target 'framework' do
project 'framework.xcodeproj'
end
target :'demo' do
project 'demo/demo.xcodeproj'
pod 'framework', :path => 'framework.podspec'
end
the .podspec file looks like this:
Pod::Spec.new do |s|
s.name = 'framework'
s.authors = { "foo author" }
s.version = '0.1.0'
s.summary = 'foo summary.'
s.homepage = 'foo homepage'
s.platform = :ios, '9.0'
s.license = {
:type => "Proprietary",
:file => "LICENSE"
}
s.source = {
:git => 'https://url.to/foo.git',
:tag => s.version.to_s
}
s.source_files = 'framework/framework/**/*.{swift,h,m}'
s.requires_arc = true
s.weak_framework = "XCTest"
s.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"',
}
end
After running pod install, Xcode/AppCode can still not see the classes from the framework project. So if I add a manual import to a class in the demo app and try to compile, it fails with:
Error:(13, 21) use of undeclared type 'FooClass'
What do I have to do to properly have the demo app project see the classes from the framework project generated pod?
Try using inherit! :search_paths on the demo target
This means they don't get their own copies of the pods but can see they exist via the header files.
platform :ios, '9.0'
workspace 'foo.xcworkspace'
target :framework do
project 'framework.xcodeproj'
end
target :demo do
inherit! :search_paths
project 'demo/demo.xcodeproj'
pod 'framework', :path => 'framework.podspec'
end
untested but perhaps worth a shot
If you install a Cocoapod don't use the file with .xcodeproj to open your project anymore, but the newly created .workspace in the same folder.
I finally resolved this issue:
Make sure the min. required iOS is defined in Podfile, e.g.:
platform :ios, '10.0'
Add any third-party pods also to the podspec file, e.g.:
spec.dependency 'Alamofire', '~> 4.5'
spec.dependency 'Serpent', '~> 1.0'
If doing pod install without the use_frameworks! it will mess up some things (see this answer: ld: framework not found Pods). So in between I got these invalid Pod xconfigs that I had to delete and then do a clean and pod install.
Make sure to build the framework project at least once and then the demo source should find the import to the framework pod name!
Make sure that all classes are correctly added to their target, especially classes in the test target should not have been added to the app target accidentally.
After all is said and done, having worked with a multitude of IDEs and development technologies, Xcode and Cocoapods can only be summed up as one giant clusterf*** of an accident!
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
I'm writing a Swift Framework and a Swift iOS Application and I'm trying to use Cocoapods to add my framework into my app and other sdks as well.
Here is my podspec for my swift framework
Pod::Spec.new do |s|
s.name = "InfraCocoa"
s.version = "0.0.1"
s.summary = "A short description of InfraCocoa."
s.license = "MIT"
s.author = { "" => "" }
s.platform = :ios
s.ios.deployment_target = "7.0 "
s.source_files = "Classes", "Classes/**/*.{swift,h,m}"
end
My pod podfile for my iOS app
target 'CocoaProjectTest' do
pod 'InfraCocoa', :path => '~/Documents/workspaces/CocoaPodsTesting/Infra/InfraCocoa'
pod 'CrashlyticsFramework', '2.2.5.2'
pod 'GoogleTagManager', '3.09'
pod 'Google-Mobile-Ads-SDK', '7.0.0'
pod 'Facebook-iOS-SDK', '3.23.0'
pod 'AFNetworking', '2.5.1'
end
Now at first if I run the 'pod install' or 'pod update' everything works fine. The problem is when I try to build in Xcode(6.1.1). I get a compile error saying stuff like this
"_sqlite3_close", referenced from:
-[TAGDataLayerPersistentStoreImpl closeDatabase] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
(maybe you meant: _fbdfl_sqlite3_close)
After a few google searchs I found it is because my GoogleTagManager is missing the libraries 'libz.dylib' and 'libsqllite3.dylib' in it's 'Link Binary With Libraries'. I can manually add them and it will compile although this is not ideal.
I decided to test without the following line in my podfile and it compiles
pod 'InfraCocoa', :path => '~/Documents/workspaces/CocoaPodsTesting/Infra/InfraCocoa'
I figured it was probably because of a conflict in library version but this InfraCocoa framework is completely clean and empty (did a File-> New-> Project -> CocoaTouch Framework).
Any ideas? (the app project too is empty and clean)
I think you could have overridden the GoogleTagManager.podspec in your PodFile and simply add the missing libraries in your modified version of the file.
something like:
pod 'GoogleTagManager', :podspec => './GoogleTagManager.podspec.json'
and in the podspec:
"libraries": ["GoogleAnalyticsServices", "sqlite3", "z"],
Seems to be working with cocoapods 0.36.rc.1
I need to add OpenTok 2.3 to a project that uses cocoapods, however only 2.1.7 is present in the pods repository or on github, so I have downloaded the framework locally. My folder structure looks something like this:
project-
|
Podfile
project.xcodeproj
frameworks/
|
OpenTokSDK-WebRTC.podspec
OpenTok-iOS-2.3.0/
|
OpenTok.framework
And the contents of the OpenTokSDK-WebRTC.podspec file is:
Pod::Spec.new do |s|
s.name = 'OpenTokSDK-WebRTC'
s.version = '2.3'
s.authors = 'TokBox'
s.summary = 'The OpenTok iOS SDK lets you use OpenTok video sessions in apps you build for iPad, iPhone, and iPod touch devices.'
s.homepage = 'https://github.com/opentok/opentok-ios-sdk-webrtc/'
s.license = {
:type => 'Apache'
}
s.source = {
:path => './OpenTok-iOS-2.3.0'
}
s.platforms = {
:ios => '5.0'
}
s.source_files = 'Opentok.framework/Versions/A/Headers/*.h'
s.resources = 'Opentok.framework/Versions/A/Resources/opentok.bundle'
s.frameworks = [
"Opentok",
"UIKit",
"CoreMedia",
"CoreVideo",
"CoreAudio",
"CoreTelephony",
"CFNetwork",
"AVFoundation",
"SystemConfiguration",
"Security",
"QuartzCore",
"AudioToolbox",
"OpenGLES",
"MobileCoreServices"
]
s.libraries = [
"stdc++",
"z"
]
s.xcconfig = {
:FRAMEWORK_SEARCH_PATHS => "\"frameworks/OpenTokSDK-WebRTC/\""
}
s.preserve_paths = 'Opentok.framework'
s.requires_arc = false
end
The relevant line in the Podfile is
pod 'OpenTokSDK-WebRTC', :path => "frameworks"
When I run 'pod install' everything appears to run fine, however there is no OpenTokSDK folder in the Pods directory and I get a file not found error in xcode when trying to include . Does anyone know what I am missing?
Thanks for your help.
As I found on their Blog Here is the link new-in-ios-10-the-best-webrtc-apps-yet. you need to Add pod 'OpenTok' in your pod file. So updated version of talk box is Added in your Project. and Now Open your xcworkspace file inplace of xcodeproj file .
Here is my Podfile ,
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectName' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'AFNetworking', '~> 3.0'
pod 'OpenTok'
# Pods for ProjectName
target 'ProjectNameTest' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
Note :- If you are using Swift then please uncomment # use_frameworks!
After updating your pod file enter "pod install" command in your terminal. and Tokbox will successfully install in your project.