I created a new podspec file which contains some dependencies.
Pod::Spec.new do |s|
s.name = "ChatSDK"
s.version = "4.2.5"
s.summary = "Chat SDK - Mobile messaging framework for iOS"
s.homepage = "http://chatsdk.co"
s.license = 'MIT'
s.author = { "Ben Smiley" => "ben#chatsdk.co" }
s.source = { :git => "https://github.com/chat-sdk/chat-sdk-ios.git", :tag => s.version.to_s }
s.platform = :ios, '7.0'
s.requires_arc = true
s.subspec 'Core' do |core|
core.source_files = ['Core/**/*']
core.dependency 'Firebase/Core'
core.dependency 'Firebase/Database'
core.dependency 'Firebase/Storage'
core.dependency 'Firebase/Auth'
end
end
I created a new Xcode project with Xcode 8.2 and added a podfile.
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'PodTest' do
pod "ChatSDK/Core", :path => "../"
end
I ran pod install using Cocoapods 1.2.0.
The project had an error message FirebaseAnalytics/FirebaseAnalytics.h file not found. This prevents the project from compiling. However, it works if I remove the use_frameworks! flag or if I add the Firebase dependencies directly to the Podfile.
CocoaPods Environment
CocoaPods : 1.2.0
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
RubyGems : 2.0.14.1
Host : Mac OS X 10.12.2 (16C67)
Xcode : 8.2 (8C38)
Git : git version 2.10.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git # dee0949e9974fff9df1e6dcacec3b0f1675165df
master_old - https://github.com/CocoaPods/Specs.git # 55393b63a3da4576423ef07b8d1f6f244594638d
private - https://bensmiley#bitbucket.org/bensmiley/pods.git # 4f14e0b26b6c6e249d49c8fa37d0eba40dde3d99
Installation Source
Executable Path: /usr/local/bin/pod
Plugins
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.1.2
cocoapods-try : 1.1.0
A demo project for this issue is available here.
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 have a set of projects like the one with the Podfile below that all share two common development pods.
platform :ios, '11.2'
use_frameworks!
workspace "AppWorkspace"
target 'App' do
project "App/app"
pod 'PromiseKit', :inhibit_warnings => true
pod 'LibKit', :path => '../LibKit'
pod 'LibUI', :path => '../LibUI'
target "AppBeta" do
inherit! :search_paths
end
end
The file system is laid out like:
AppProject
App
LibKit
LibUI
For brevity here's the Podspec for the LibUI since it also contains the resource bundles:
Pod::Spec.new do |s|
s.name = 'LibUI'
s.module_name = 'LibUI'
s.version = '0.1.1'
s.summary = 'A collection of UI components.'
s.description = <<-DESC
A collection of shared UI components
DESC
s.homepage = 'https://github.com/Foo/LibUI'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'ME' => '------#---------.com' }
s.source = { :git => 'https://github.com/Foo/LibUI.git' }
s.platform = :ios
s.ios.deployment_target = '10.0'
s.swift_version = "4.0"
s.source_files = 'LibUI/Classes/**/*'
s.resource_bundles = {
'LibUIBundle' => ['LibUI/Assets/*.xib', 'LibUI/Assets/*.xcassets']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
s.frameworks = 'UIKit'
end
When building and running the app, I run into this error:
dyld: Library not loaded: #rpath/PromiseKit.framework/PromiseKit
Referenced from: /Users/me/Library/Developer/CoreSimulator/Devices/486B5EFB-6F18-45A7-AA78-07D18C0909FC/data/Containers/Bundle/Application/830433F4-AA5A-402E-9A81-E2A7C6A61EA7/AppBeta.app/AppBeta
Reason: image not found
This error repeats for each of the pods until I change the Mach-O Type build setting in the Pods project from Dynamic Library to Static Library for each of them.
However, then I'm met with the following set of errors:
Unknown class _TtC8LibUI18SVTabBarController in Interface Builder file.
Unknown class _TtC8LibUI22SVNavigationController in Interface Builder file.
Unknown class _TtC8LibUI22SVNavigationController in Interface Builder file.
Could not load NIB in bundle: 'NSBundle /Users/me/Library/Developer/CoreSimulator/Devices/486B5EFB-6F18-45A7-AA78-07D18C0909FC/data/Containers/Bundle/Application/72B43E50-7A5D-4122-8CD3-09B862C5C6D4/AppBeta.app> (loaded)' with name 'MessageView''
The missing classes referenced from the storyboard file are in the LibUI pod, and the Module field is properly set to LibUI for the respective instances of those classes in Interface Builder.
The MessageView class is a member of the LibUI Pod. A class func of that class attempts to load a XIB from the resource_bundles, LibUIBundle, as follows:
let libUIBundle = Bundle(for: MessageView.self)
let resourceBundleURL = libUIBundle.resourceURL?.appendingPathComponent("LibUIBundle.bundle")
let resourceBundle = Bundle(url: resourceBundleURL!)
guard let messageView: MessageView = UINib(nibName: "MessageView", bundle: resourceBundle).instantiate(withOwner: nil, options: nil)[0] as? MessageView else { return }
This was updated recently to reflect suggestions in other SO posts I searched for.
All of this previously worked until updating to iOS 11, which we put off until recently. It seems as though the Pods project is not properly copying frameworks (when dynamically linked) and resources into my App's bundle.
I've already updated Cocoapods. I also deleted my Workspace and project files for this project, and then recreated them with the defaults---re-adding all the files back to the project---to avoid any lingering build settings that might have been affecting this situation. Am I doing something foolish? How has no one else run into this if it's a bug?
Stack
CocoaPods : 1.4.0.rc.1
Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
RubyGems : 2.5.2
Host : Mac OS X 10.13.2 (17C88)
Xcode : 9.2 (9C40b)
Git : git version 2.14.3 (Apple Git-98)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git # e205fb520bcc24de216064c32914c85a2aaa25cc
LibPods - https://github.com/Foo/LibPods.git # 2c7954bf3d48a9d21ff9967fe6aa31d371e063e7
Installation Source
Executable Path: /usr/local/bin/pod
Plugins
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
I finally found the relevant issues on Github that I'll link here in case anyone else comes across this:
Pods that are used by embedded dynamic frameworks can't be found in linked targets.
No 'Embed Pods frameworks' build phase when building custom framework ?
I want use version '1.1.0' of Alamofire-SwiftyJSON
My Podfile is:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '1.2.3'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :tag => '2.2.0'
pod 'Alamofire-SwiftyJSON', :git => "https://github.com/SwiftyJSON/Alamofire-SwiftyJSON.git", :tag => '1.1.0'
and I got follow error:
Analyzing dependencies
Pre-downloading: `Alamofire` from `https://github.com/Alamofire/Alamofire.git`, tag `1.2.3`
Pre-downloading: `Alamofire-SwiftyJSON` from `https://github.com/SwiftyJSON/Alamofire-SwiftyJSON.git`, tag `1.1.0`
[!] Unable to find a specification for 'Alamofire-SwiftyJSON'.
This is a normal situation. The Alamofire-SwiftyJSON repository does not have a podspec into its repo at the tag 1.1.0 and no pod has been push to the cocoapod trunk.
You will have to fork the project, and add the Alamofire-SwiftyJSON.podspec to the root by yourself. An example of what it should look like:
Pod::Spec.new do |s|
s.name = "Alamofire-SwiftyJSON"
s.version = "1.1.0"
s.summary = "Alamofire extension for serialize NSData to SwiftyJSON "
s.homepage = "https://github.com/[your github name]/Alamofire-SwiftyJSON"
s.license = { :type => "MIT" }
s.requires_arc = true
s.osx.deployment_target = "10.9"
s.ios.deployment_target = "8.0"
s.source = { :git => "https://github.com/[your github name]/Alamofire-SwiftyJSON.git", :tag => s.version }
s.source_files = "Source/*.swift"
s.dependency 'Alamofire', '1.3'
s.dependency 'SwiftyJSON', '2.2.0'
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".
I am trying to send a library to the CocoaPods repo, but it fails the push procedure.
However, it does not fail the lint check as we can see here:
$ pod spec lint GUIPlayerView.podspec
-> GUIPlayerView (0.0.1)
Analyzed 1 podspec.
GUIPlayerView.podspec passed validation.
$ pod trunk push GUIPlayerView.podspec
Validating podspec
-> GUIPlayerView (0.0.1)
[!] The Pod Specification did not pass validation.
There is no error or warning message. My local git repo is synced and up-to-date with the remote's master. What can I do?
Edit: here's the podspec file:
Pod::Spec.new do |s|
s.name = "GUIPlayerView"
s.version = "0.0.1"
s.summary = "GUIPlayerView is a simple video player embedded into a UIView."
s.homepage = "https://github.com/guilhermearaujo/GUIPlayerView"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Guilherme Araújo" => "me#mail.com" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/guilhermearaujo/GUIPlayerView.git", :tag => "0.0.1" }
s.source_files = "GUIPlayerView/Classes", "Classes/**/*.{h,m}"
s.exclude_files = "GUIPlayerView/Classes/Exclude"
s.resources = "GUIPlayerView/Resources/*.png"
s.framework = "AVFoundation"
end
I learned about the --verbose parameter and reading through the logs I saw that the key s.requires_arc = true was missing.
For some reason, this warning was not shown without the --verbose flag.