'objective c framework with swift public class "Undefined symbol: type metadata accessor for"
I have an objective c framework, used as a pod, which has a public header and a swift public class that expose some methods to the host app. I use obj c public header like this in my appdelegate:
let instanceOfMyApi = MyApi()
instanceOfMyApi.initialize(launchOptions, uuid:"xxx", merchantId: "xxx", lang: "el")
later in my ViewControllers I use my framework's swift public class like this:
@IBAction func navigate(sender: UIButton) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponsViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
and
@objc public class CouponsViewController: UIViewController, UITableViewDataSource {
@IBOutlet weak var couponImage: UIImageView!
var instanceOfMySwiftApi : swiftApi.Type = swiftApi.self
var coupons: Array<swiftApi.CouponItemModel>!
@IBOutlet weak var couponsTableView: UITableView!
@IBOutlet weak var couponsTableViewCell: UITableViewCell!
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.coupons = instanceOfMySwiftApi.getCoupons()
couponsTableView.register(UITableViewCell.self,
forCellReuseIdentifier: "couponsTableViewCell")
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.coupons.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "couponsTableViewCell",
for: indexPath)
// cell.textLabel?.text = self.coupons[indexPath.row].name
return cell
}
}
When I try to run the app I get the errors:
Undefined symbol: _OBJC_CLASS_$_MyApi
Undefined symbol: type metadata accessor for SwiftXXXFramework.MyEmptyClass
Undefined symbol: nominal type descriptor for SwiftXXXFramework.swiftApi
Undefined symbol: type metadata accessor for SwiftXXXFramework.swiftApi.CouponItemModel
Undefined symbol: nominal type descriptor for SwiftXXXFramework.swiftApi.CouponItemModel
Undefined symbol: type metadata accessor for SwiftXXXFramework.swiftApi
What is wrong with my framework or the host app??
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
