.xib
を含むCocoaPodを2日間使用しても無駄です。私は私のPodfileへpod 'OrderStatusTable', :git => 'https://github.com/myname/OrderStatusTableView.git', :tag => ‘1.2.0’
を追加している、私のサンプルプロジェクトでは致命的なエラー:バンドルへのパスを作成できませんでした
Pod::Spec.new do |s|
s.name = "OrderStatusTable"
s.version = "1.2.0"
s.platform = :ios
s.ios.deployment_target = '9.0'
s.summary = "Order Status UITableView framework."
s.description = "A UITableView framework with custom view."
s.homepage = "https://github.com/myname/OrderStatusTableView"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "My Name" => "My Email" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/myname/OrderStatusTableView.git", :tag => "1.2.0" }
s.source_files = "OrderStatusTable/**/*.{h,m,swift}"
s.resource_bundles = {
'OrderStatusTable' => [
'Pod/**/*.xib'
]
}
end
:私は次の.podspec
と私のフレームワークのためのスタンドアロンのXcodeプロジェクトを持っています。私.xib
ファイルは、サンプルプロジェクトでポッド内のResourcesフォルダに含まれるが、私はこのエラーを得続ける:fatal error: Could not create a path to the bundle: file /Users/myname/Desktop/appname/OrderStatusTableDemo/Pods/OrderStatusTable/OrderStatusTable/OrderStatusTable.swift, line 40
それはUITableView
フレームワークだと私は、セルの再利用識別子を使用してカスタムUITableViewCell
ペン先を登録しようとしているが、このように:私は間違っているバンドルURLForResource
または何を持っている場合
public class OrderStatusTable: UITableView {
public override func awakeFromNib() {
delegate = self
dataSource = self
let podBundle = NSBundle(forClass: self.classForCoder)
if let bundleURL = podBundle.URLForResource("OrderStatusTable", withExtension: "bundle") {
if let bundle = NSBundle(URL: bundleURL) {
let cellNib = UINib(nibName: "OrderStatusTableViewCell", bundle: bundle)
registerNib(cellNib, forCellReuseIdentifier: "OrderStatusTableViewCell")
} else {
assertionFailure("Could not load the bundle")
}
} else {
assertionFailure("Could not create a path to the bundle")
// This keeps getting called
}
}
だから私はわからないんだけど?これはあまりよくオンラインで文書化されていません。誰か助言してもらえますか?ありがとう!