cocoapods

使用CocoaPods来做iOS程序的包依赖管理

时光怂恿深爱的人放手 提交于 2019-11-30 01:37:28
前言 每种语言发展到一个阶段,就会出现相应的依赖管理工具, 或者是中央代码仓库。比如 Java: maven,Ivy Ruby: gems Python: pip, easy_install Nodejs: npm 随着iOS开发者的增多,业界也出现了为iOS程序提供依赖管理的工具,这个工具叫: CocoaPods 。 CocoaPods简介 CocoaPods是一个负责管理iOS项目中第三方开源代码的工具。CocoaPods 项目的源码 在Github上管理。该项目开始于2011年8月12日,经过一年多的发展,现在已经超过1000次提交,并且持续保持活跃更新。开发iOS项目不可避免地要使用第三方开源库,CocoaPods的出现使得我们可以节省设置和更新第三方开源库的时间。 拿我之前开发的粉笔网iPhone客户端为例,其使用了14个第三方开源库。在没有使用CocoaPods以前,我需要: 把这些第三方开源库的相关文件复制到项目中,或者设置成git的submodule,然后这些开源库通常需要依赖系统的一些framework,我需要手工地将这些framework一一增加到项目依赖中,比如ASI网络库就需要增加以下framework: CFNetwork, SystemConfiguration, MobileCoreServices, CoreGraphics and zlib。

使用CocoaPods管理第三方库

£可爱£侵袭症+ 提交于 2019-11-30 01:37:09
DEC 2 ND , 2012 前言 每种语言发展到一个阶段,就会出现相应的依赖管理工具, 或者是中央代码仓库。比如 Java: maven,Ivy Ruby: gems Python: pip, easy_install Nodejs: npm 随着iOS开发者的增多,业界也出现了为iOS程序提供依赖管理的工具,这个工具叫: CocoaPods 。 CocoaPods简介 CocoaPods是一个负责管理iOS项目中第三方开源代码的工具。CocoaPods 项目的源码 在Github上管理。该项目开始于2011年8月12日,经过一年多的发展,现在已经超过1000次提交,并且持续保持活跃更新。开发iOS项目不可避免地要使用第三方开源库,CocoaPods的出现使得我们可以节省设置和更新第三方开源库的时间。 拿我之前开发的粉笔网iPhone客户端为例,其使用了14个第三方开源库。在没有使用CocoaPods以前,我需要: 把这些第三方开源库的相关文件复制到项目中,或者设置成git的submodule,然后这些开源库通常需要依赖系统的一些framework,我需要手工地将这些framework一一增加到项目依赖中,比如ASI网络库就需要增加以下framework: CFNetwork, SystemConfiguration, MobileCoreServices,

清华大学 CocoaPods 镜像使用帮助

佐手、 提交于 2019-11-30 01:36:56
清华大学镜像网址 https://mirrors.tuna.tsinghua.edu.cn/ CocoaPods 镜像使用帮助 CocoaPods 是一个 Cocoa 和 Cocoa Touch 框架的依赖管理器,具体原理和 Homebrew 有点类似,都是从 GitHub 下载索引,然后根据索引下载依赖的源代码。 对于旧版的 CocoaPods 可以使用如下方法使用 tuna 的镜像: $ pod repo remove master $ pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git $ pod repo update 新版的 CocoaPods 不允许用pod repo add直接添加master库了,但是依然可以: $ cd ~/.cocoapods/repos $ pod repo remove master $ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master 最后进入自己的工程,在自己工程的podFile第一行加上: source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git

CocoaPods的安装使用和常见问题

一世执手 提交于 2019-11-30 01:36:39
原文:http://www.jianshu.com/p/6e5c0f78200a 一、什么是CocoaPods CocoaPods是iOS项目的依赖管理工具,该项目源码在Github上管理。开发iOS项目不可避免地要使用第三方开源库,CocoaPods的出现使得我们可以节省设置和第三方开源库的时间。 在使用CocoaPods之前,开发项目需要用到第三方开源库的时候,我们需要 1.把开源库的源代码复制到项目中 2.添加一些依赖框架和动态库 3.设置-ObjC,-fno-objc-arc等参数 4.管理他们的更新 在使用CocoaPods后,我们只需要把用到的开源库放到一个名为Podfile的文件中,然后执行pod install.Cocoapods就会自动将这些第三方开源库的源码下载下来,并且为我们的工程设置好响应的系统依赖和编译参数。 二、CocoaPods的原理 CocoaPods的原理是将所有的依赖库都放到另一个名为Pods的项目中,然后让主项目依赖Pods项目,这样,源码管理工作都从主项目移到了Pods项目中。Pods项目最终会编译成一个名为libPods.a的文件,主项目只需要依赖这个.a文件即可。 三、CocoaPods的安装 CocoaPods可以方便地通过Mac自带的RubyGems安装。 打开Terminal,然后键入以下命令: $ sudo gem install

mark~ 10.11 cocoapods安装

折月煮酒 提交于 2019-11-30 01:36:06
执行 sudo gem install cocoapods 出现错误: ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj 自定义GEM_HOME $ mkdir -p $HOME/Software/ruby $ export GEM_HOME=$HOME/Software/ruby $ gem install cocoapods [...] 1 gem installed $ export PATH=$PATH:$HOME/Sofware/ruby/bin $ pod --version 0.39.0 执行完这句如果报告以下错误: ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) ( https://rubygems.org/latest_specs.4.8.gz ) ERROR: Possible alternatives: cocoapods

Class is implemented in both, One of the two will be used. Which one is undefined

依然范特西╮ 提交于 2019-11-30 01:33:27
I have an issue with dependencies included in Cocoapods. I have a Framework project (MyFramework target), which also has App target (MyFrameworkExampleApp). When I try to run the app, I get a console full of errors like so: Class PodsDummy_AFNetworking is implemented in both /private/var/containers/Bundle/Application/AD85D7EC-2652-4019-94FB-C799D0FBA69B/MyFrameworkExampleApp.app/Frameworks/MyFramework.framework/MyFramework (0x1019a0438) and /var/containers/Bundle/Application/AD85D7EC-2652-4019-94FB-C799D0FBA69B/MyFrameworkExampleApp.app/MyFrameworkExampleApp (0x10107c558). One of the two will

Cocoapods: Unable to find a specification for `Firebase/Core`

和自甴很熟 提交于 2019-11-30 01:30:01
I have this in podfile: pod 'Firebase/Core' pod 'Firebase/Messaging' but getting this error: [!] Unable to find a specification for Firebase/Core i tried with pod 'Firebase' still can't find it. Podfile: # Uncomment this line to define a global platform for your project # platform :ios, '8.0' # Uncomment this line if you're using Swift use_frameworks! target 'caffetouch manager' do pod 'Firebase/Core' pod 'Firebase/Messaging' pod 'Alamofire', '~> 4.0.0' pod 'AlamofireNetworkActivityIndicator', '~> 2.0.1' pod 'IQKeyboardManagerSwift', '~> 4.0.6' pod 'MZFormSheetPresentationController', '~> 2.4

Xcode 10.2, Swift 5, Command compileSwift failed while build the program with Release Scheme

旧城冷巷雨未停 提交于 2019-11-30 01:20:49
问题 I'm using Xcode 10.2, Swift 5. With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a nonzero exit code. I've tried delete DerivedData / Clean / pod deintegrate & pod install & pod update. None of these works. 回答1: For my project problem was related to pod Cache which gives error when Optimization Level for Release is set to Optimize for Speed [-O] . I have set Compilation Mode to Whole Module again and set

The dependency `AFNetworking (~> 2.5)` is not used in any concrete target

吃可爱长大的小学妹 提交于 2019-11-30 00:42:22
问题 I want to install AFNetworking but I have a problem, how can I fix and install? I used Getting Started with AFNetworking : 1. Download CocoaPods sudo gem install cocoapods pod setup 2.a. Create a Podfile touch Podfile open -a Xcode Podfile 2.b. And copy-paste this: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '7.0' pod 'AFNetworking', '~> 2.5' 回答1: Add: target 'MyApp' do pod 'AFNetworking', '~> 2.5' end See: https://guides.cocoapods.org/using/the-podfile.html Then run pod

Editing locked files from a CocoaPods framework

有些话、适合烂在心里 提交于 2019-11-30 00:29:05
问题 I have an Xcode workspace that uses CocoaPods to include several third-party frameworks. I would like to edit a line of source code within one of these dependencies. However, when I do so, Xcode warns me that the file is locked and that any changes I make may not be saved. So my question is: will my changes to the source code be discarded when I run a pod install/update? If not, is there any other scenario, possibly unrelated to CocoaPods, that would discard my changes? And finally, is there