I am trying to create a COACOAPOD Library that uses IOS-Pods-DFU-Library as one of the dependency. I am using COACOAPODS for my dependency management. I am releasing my library as a binary framework and customers will integrate it with their app using COACOAPODS from localhost server with our custom podspec file that will download our binary framework from locahost server and resolve other dependencies.
Before Integrating iOSDFULibrary its used to works fine in the Customer applications. But after specifying iOSDFULibrary I am getting the following error
CustomerTest/Pods/Zip/Zip/minizip/module.modulemap:1:8: error: redefinition of module 'minizip'
module minizip [system][extern_c] {
^
/Modules/xxxxxx/Pods/Zip/Zip/minizip/module.modulemap:1:8: note: previously defined here
module minizip [system][extern_c] {
^
:0: error: could not build Objective-C module 'Zip'
Am i missing something here? Any help will be appreciated.
Below are our sample podspec file and example how user includes our library.
Pod::Spec.new do |s|
s.name = "xxxxxx"
s.version = "1.0.0"
s.summary = "xxxxxx description ."
s.author = { "" => "" }
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
s.ios.preserve_paths = 'xxxxxx.framework/*.bundle'
s.ios.deployment_target = "9.0"
s.source = {
:http => 'http://localhost:8000/xxxxxx.zip'
}
s.ios.vendored_frameworks = 'xxxxxx.framework'
s.dependency 'SSZipArchive', ' 2.1'
s.dependency 'XCGLogger', ' 6.0'
s.dependency "iOSDFULibrary", '4.1.1'
end
Customers will include our library by specifying above podsepec file path as below in their pod file
pod 'xxxxxx', :podspec => './xxxxxx.podspec'
I had the same problem with the minizip module when using the Zip Cocoapod. For me the module was also declared double in both the Pods project as well as the app project. What fixed it for me was this answer.
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'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.
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.
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++'