1:解決CocoaPods安裝時報的問題,http://ruby.taobao.org/latest_specs.4.8.gz 報404 解決 bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz) 原因:淘寶停 ...
1:解決CocoaPods安裝時報的問題,http://ruby.taobao.org/latest_specs.4.8.gz 報404
解決 bad response Not Found 404 (http://ruby.taobao.org/latest_specs.4.8.gz)
原因:淘寶停止基於 HTTP 協議的鏡像服務 需要改用https的協議
gem sources --remove http://ruby.taobao.org/ gem sources -a https://ruby.taobao.org/ gem sources -l sudo gem install -n /usr/local/bin cocoapods
當然如果你是第一次安裝時(目前網上有些安裝資料可能還指向淘寶的http):
gem sources -l gem sources --remove https://rubygems.org/ gem sources -a https://ruby.taobao.org/ gem sources -l sudo gem install -n /usr/local/bin cocoapods
2:CocoaPods更新版本後,安裝跟更新第三方報錯
Update all pods Re-creating CocoaPods due to major version update. Updating local specs repositories Analyzing dependencies [!] The dependency `ReactiveCocoa (~> 2.5)` is not used in any concrete target. The dependency `SDWebImage (~> 3.7.5)` is not used in any concrete target. The dependency `AFNetworking (~> 2.5.4)` is not used in any concrete target. The dependency `Masonry (~> 0.6.4)` is not used in any concrete target. The dependency `JSONModel (~> 1.2.0)` is not used in any concrete target. The dependency `JCAlertView (~> 1.1.5)` is not used in any concrete target. The dependency `RongCloudIMKit (= 2.5.2)` is not used in any concrete target. The dependency `SMPageControl (~> 1.2)` is not used in any concrete target. The dependency `FMDB` is not used in any concrete target. The dependency `GTSDK` is not used in any concrete target. The dependency `BaiduMapKit` is not used in any concrete target. The dependency `UMengAnalytics-NO-IDFA` is not used in any concrete target. The dependency `Fabric` is not used in any concrete target. The dependency `Crashlytics` is not used in any concrete target. The dependency `CocoaLumberjack` is not used in any concrete target. The dependency `TTTAttributedLabel` is not used in any concrete target. The dependency `FLEX` is not used in any concrete target. The dependency `GVUserDefaults` is not used in any concrete target. The dependency `UMengFeedback (~> 2.3.4)` is not used in any concrete target. The dependency `TYAttributedLabel (~> 2.5.6)` is not used in any concrete target. The dependency `IQKeyboardManager` is not used in any concrete target. The dependency `MWPhotoBrowser` is not used in any concrete target.
可以通過 $ pod --version 查看版本號;
原因是podfile升級到最新版本,pod里的內容必須明確指出所用第三方庫的target;可以修改Podfile文件的配置文件,讓它相容不指定固定版本;且又不報錯;
platform :ios, '7.0' target 'zxptUser’ do pod 'ReactiveCocoa', '~> 2.5' pod 'SDWebImage', '~> 3.7.5' pod 'AFNetworking', '~> 2.5.4' pod 'Masonry', '~> 0.6.4' pod 'JSONModel', '~> 1.2.0' pod 'JCAlertView', '~> 1.1.5' pod 'RongCloudIMKit', '2.5.2' #不要更新此庫 源代碼已被修改 pod 'SMPageControl', '~> 1.2' pod 'FMDB' pod 'GTSDK' pod 'BaiduMapKit' #百度地圖SDK pod 'UMengAnalytics-NO-IDFA'#友盟統計無IDFA版SDK pod 'Fabric' pod 'Crashlytics' pod 'CocoaLumberjack' pod 'TTTAttributedLabel' pod 'FLEX' pod 'GVUserDefaults' pod 'UMengFeedback', '~> 2.3.4' pod 'TYAttributedLabel', '~> 2.5.6’ pod 'IQKeyboardManager' pod 'MWPhotoBrowser' end
其中zxptUser要換成當前target名,最後不要忘記增加一個end結尾,當然如果你的工程是有多個target都要引用;則要使用link_with(這個一定要放在文件第一行)如下:
link_with ['zxptUser' ,'zxptUser_local', 'zxptUser_AppStore'] platform :ios, '7.0' pod 'ReactiveCocoa', '~> 2.5' pod 'SDWebImage', '~> 3.7.5' pod 'AFNetworking', '~> 2.5.4' pod 'Masonry', '~> 0.6.4' pod 'JSONModel', '~> 1.2.0' pod 'JCAlertView', '~> 1.1.5' pod 'RongCloudIMKit', '2.5.2' #不要更新此庫 源代碼已被修改 pod 'SMPageControl', '~> 1.2' pod 'FMDB' pod 'GTSDK' pod 'BaiduMapKit' #百度地圖SDK pod 'UMengAnalytics-NO-IDFA'#友盟統計無IDFA版SDK pod 'Fabric' pod 'Crashlytics' pod 'CocoaLumberjack' pod 'TTTAttributedLabel' pod 'FLEX' pod 'GVUserDefaults' pod 'UMengFeedback', '~> 2.3.4' pod 'TYAttributedLabel', '~> 2.5.6’ pod 'IQKeyboardManager' pod 'MWPhotoBrowser'
註意基中本工程中有三個target名字,'zxptUser' ,'zxptUser_local', 'zxptUser_AppStore'
3:不同的target引用不同的第三方插件
target :'zxptUser' do platform :ios pod 'Reachability', '~> 3.0.0' pod 'SBJson', '~> 4.0.0' platform :ios, '7.0' pod 'AFNetworking', '~> 2.0' end target :'zxptUser_local' do pod 'OpenUDID', '~> 1.0.0' end
註意每個都要以end結尾
4:刪除CocoaPods版本,並安裝指定版本
比如我本來安裝完CocoaPods 1.0.0版,但發現它實現跟先前還是差別滿大的,決定降回0.39這個比較穩定版本;就可以用命令先刪除本地的CocoaPods版本,再指定安裝特定版本;
a 卸載 cocoapods(它會提示你要刪除本地哪個版也可以全刪)
sudo gem uninstall cocoapods
b 安裝 0.39版本
sudo gem install -n /usr/local/bin cocoapods -v 0.39
5:更新PODS後,報diff: /../Podfile.lock: No such file or directory 錯誤
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
如圖
解決辦法:
查看工程中PROJECT中Configurations中相關配置是否正準,有可能某個分枝指到一個不存在的pods導致;
6:當PODS引入第三方後,項目中引用時發現頭文件卻顯示不存在
排查辦法,可以看到相應的targets裡面的Build Phases中的Link Binary WithLibraries裡面是否有把libPods.a庫引入進來
一般出現沒有引入進來可能是podFile指定的相應Targets導致其它的Targets沒有這個庫;
7:友盟最新版SDK調整
a:#import“MobClick.h”引入頭文件由原來,更新為:#import "UMMobClick/MobClick.h"
b:初始化配置文件也進行更改,採用UMConfigInstance全局變數設置:
UMConfigInstance.appKey=kUMAnalyticsAppKey; UMConfigInstance.channelId=@"App Store"; [MobClick startWithConfigure:UMConfigInstance];
8:關於融雲跟百度地圖支持IPV6
融雲SDK 從2.5.2開始 百度地圖SDK 從3.0.0開始