簡體   English   中英

將本地化的xib文件包含在私有cocoapod中

[英]Including localized xib files in a private cocoapod

所以我認為這應該是非常容易的但是經過一天的谷歌搜索和玩游戲后我仍然無法讓這個工作。 我有一個私人cocoapod從私人git存儲庫下載代碼。 這一切都設置好了。

我正在努力的是我需要在cocoapod中包含本地化的xib。 我有一個LoginView,它是我們許多內部應用程序的共享代碼。 但是,我們有本地化版本的視圖。 由於cocoapods扁平化結構的方式,我只能復制本地化的xib,導致* .lproj目錄丟失。 當我嘗試使用cocoapod時,無論設備上的語言設置如何,它似乎都會拾取第一個xib。

我希望有人可以指導我如何保留文件夾heirachy,或者是否有另一種方法將本地化的xib包含在cocoapod中。

#
# Be sure to run `pod lib lint NAME.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = "ios-XX-common"
  s.version          = "1.0"
  s.summary          = "XXXXXX"
  s.description      = "Pod containing common source code used across multiple apps"
  s.homepage         = "http://www.example.com"
  s.license          = 'Copyright'
  s.author           = { xxx }
  s.source           = { :git => "xxxx:/data/git/ios-xx-common.git", :tag => 'v1.0'}
  s.platform = :ios, '7.0'
  s.requires_arc = false
  s.header_dir = 'ios-xx-common'
  s.header_mappings_dir = 'CommonSourceCode'
  s.source_files = "CommonSourceCode/**/*.{h,m}", "CommonSourceCode/CustomUIObjects/**/*.{h,m}",
                   "CommonSourceCode/Data Objects/**/*.{h,m}", "CommonSourceCode/Helpers/**/*.{h,m}", 
                   "CommonSourceCode/UID/**/*.{h,m}", "CommonSourceCode/UIViews/**/*.{h,m}",
                   "CommonSourceCode/ViewControllers/**/*.{h,m}" 
  s.resource_bundles = { 'rr-common-xibs' => ['CommonResources/Xibs/*.lproj'],
                         'rr-common-other' => ['CommonResources/Icons/*.*', 'CommonResources/IPhone/*.*', 'CommonResources/IPhoneIPad/*.*', 'CommonResources/Sounds/*.*'] }
  s.public_header_files = '**/*.h'
  s.dependencies = { 'Parse-iOS-SDK' => '~> 1.2.19', 'CocoaLumberjack' => '~> 1.7.0',
   'MBProgressHUD' => '~> 0.8', 'AFNetworking' => '~> 1.0' }
end

謝謝

我想你可能會追隨“開發莢”。

所以我有兩個項目,一個圖書館項目和一個特定於應用程序的項目。 在我的庫項目中,我有一個library.podspec文件

Pod::Spec.new do |s|
    s.name         = "Library"
    s.version      = "0.0.1"
    s.summary      = "Shared library."
    s.description  = "This is an iOS library for shared common code across all apps"
    s.homepage     = "http://blah.com"
    s.license      = 'COMMERCIAL'
    s.author             = { "My name" => "my@email.com" }
    s.social_media_url = "http://twitter.com/blah"
    s.platform     = :ios, '8.0'
    s.source       = { :git => "https://bitbucket.org/blah/library.git", :tag => '0.0.1' }
    s.source_files  = 'Library/Classes/**/*.{h,m}', 'Library/Models/**/*.{h,m}', 'Library/ViewModels/**/*.{h,m}', 'Library/Views/**/*.{h,m}'
    s.resources = "Library/Images/**/*.png", "Library/Images/**/*.jpg", 'Library/Views/**/*.xib', "Library/Fonts/*.otf"
    s.requires_arc = true
    s.framework    = 'MapKit', 'CoreLocation'
    s.dependency 'AFNetworking'
    s.dependency 'ReactiveCocoa'
    s.dependency 'JLRoutes'
end

然后在我的特定應用程序項目的Podfile中......

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
link_with 'Myapp', 'Myapp-Tests'

pod 'Library', :path => '../library/'

現在,當我為我的特定應用程序項目運行“pod update”時,我可以在Pod項目下看到而不是在Pods下,我有一個名為Development Pods的新文件夾。 請注意,如果在庫項目中添加新文件,請確保再次進行pod更新。

和平。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM