2014-07-11 18 views
7

Vì vậy, tôi hình dung điều này thực sự dễ dàng nhưng sau một ngày Googling và chơi xung quanh tôi vẫn không thể làm việc này được. Tôi có một cocoapod riêng để tải mã từ kho git riêng. Đây là tất cả các thiết lập và hoạt động tốt.Bao gồm các tệp xib được bản địa hóa trong một tệp cocoapod riêng

Điều tôi đang gặp phải là tôi cần phải bao gồm xib được bản địa hóa trong cocoapod. Tôi có một LoginView được chia sẻ mã trên một số ứng dụng nội bộ của chúng tôi. Tuy nhiên, chúng tôi đã bản địa hoá các phiên bản của chế độ xem. Từ những gì tôi có thể nói do cách cocoapods flattens ra cấu trúc nó chỉ là sao chép xib bản địa hóa mà gây ra các thư mục * .lproj bị mất. Khi tôi sau đó thử và sử dụng cocoapod nó dường như để chọn xib đầu tiên bất kể cài đặt ngôn ngữ trên thiết bị.

Tôi hy vọng một người nào đó có thể hướng dẫn tôi về cách tôi tiếp tục giữ lại thư mục kế thừa hoặc nếu có cách khác để đưa các xib địa phương vào 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 

Cảm ơn

+0

Đây có phải là nội dung bạn đang tìm kiếm không? http://stackoverflow.com/questions/21168826/preserve-folder-structure-cocoa-pods – Rob

+1

Sử dụng 's.resources' – onmyway133

Trả lời

1

Tôi nghĩ rằng bạn có thể là sau khi "Phát triển Pods".

Vì vậy, tôi có hai dự án, một dự án thư viện và một dự án ứng dụng cụ thể. Trong dự án thư viện của tôi, tôi có một tập tin 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" => "[email protected]" } 
    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 

Sau đó, trong Podfile ứng dụng dự án cụ thể của tôi ...

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

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

Bây giờ khi tôi chạy "cập nhật pod" cho dự án ứng dụng cụ thể của tôi, tôi có thể thấy trong dự án Pod thay vì dưới Pod, tôi có một thư mục mới có tên là Development Pods. Chỉ cần lưu ý rằng nếu bạn thêm các tệp mới trong dự án Thư viện của mình, hãy nhớ cập nhật pod lần nữa.

Hòa bình.

Các vấn đề liên quan