2014-10-09 87 views
4

我有一個麻煩。 我創建了簡單的項目,並在結果中有下一個文件:ViewController.h,ViewController.m,ViewController.xib,ViewController.podspec和LICENSE。Xcode,cocoapods + nib文件,s.resources = ['*。{xib}']不起作用

Structure of ViewController.podspec: 
Pod:: Spec.new do |s| 
    s.name    = "ViewController" 
    s.version   = "0.1.0" 
    s.summary   = "Some text" 
    s.homepage   = "setmypage" 
    s.license   = 'MIT' 
    s.author   = { "Oleksii" => "[email protected]" } 
    s.source   = { :path => "." } 
    s.platform  = :ios 
    s.requires_arc = true 
    s.source_files = '*.{h,m,xib}' 
    s.resources = ['*.{xib}'] 

end 

我創建了簡單的新項目並添加了Pod文件夾。

在爲我的Pod 做了pod lib lint之後,並執行pod安裝此pod。

Structure Podfile: 
platform :ios 
pod "ViewController", :path => "testPod/" 
    pod 'ViewController' 

好的。我有我的Pod的項目。但是當我嘗試構建我的項目時,我收到了 無法運行命令'StripNIB ViewController.nib' - 此目標可能包含它自己的產品。

我該怎麼辦?

回答

4

我有同樣的問題。你不應該包括在SOURCE_FILES參數的廈門國際銀行在podspecs:

s.source_files = '*.{h,m,xib}' 
s.resources = ['*.{xib}'] 

我podspecs是因爲默認情況下cocoapod版本比你有一點點不同0.39在其中顯然太包容了SOURCE_FILES設置一個通配符,甚至如果我的廈門國際銀行被列爲資源(resource_bundle):

s.source_files = 'Pod/Classes/**/*.{h,m}' 
s.resource_bundles = { 
    'MyPodBundle' => ['Pod/Classes/**/*.xib'] 
} 

因此,請確保您不包括您的廈門國際銀行作爲SOURCE_FILES

+0

謝謝!有用。 – Oleksii 2015-12-15 11:55:52

1

可能的原因是您將您的產品目標列在目標依賴關係下。在xcode中選擇您的目標並在Build Phases下查看Dependencies list您的產品目標不應在此處列出。

另請檢查您的Bundle ResourcesLink Binary with Libraries您不能在那裏列出您的產品。

+0

1)目標相關性(0項);鏈接二進制庫包含帶紅色名稱的「LibPods.a」 – Oleksii 2014-10-09 15:22:08

+0

在複製包資源(4項)中:Main.storyboard,ViewController.podspec,LaunchScreen.xib,Images.xcassets – Oleksii 2014-10-09 15:33:03