feat: 更新 Bridging Header 和错误信息文件以支持新模型

主要变更:
1. 在 Bridging Header 中添加了对 PIBaseModel 和 MomentsInfoModel 的引用,以支持新的数据模型。
2. 更新了 error message.txt 文件,增加了详细的编译错误信息,帮助开发者快速定位问题。
3. 在 .gitignore 中添加了 error message.txt,以避免将错误信息文件纳入版本控制。

此更新旨在提升代码的可维护性和调试效率,确保新模型的顺利集成。
This commit is contained in:
edwinQQQ
2025-10-11 19:06:08 +08:00
parent e318aaeee4
commit 26d9894830
5 changed files with 265 additions and 43 deletions

View File

@@ -18,32 +18,24 @@ import Foundation
/// - failure: (, )
@objc func fetchLatestMomentsWithNextID(
_ nextID: String,
completion: @escaping (NSArray, String) -> Void,
completion: @escaping ([MomentsInfoModel], String) -> Void,
failure: @escaping (Int, String) -> Void
) {
let pageSize = "20"
let types = "0,2" // +
Api.momentsLatestList({ (data, code, msg) in
if code == 200 {
// 使 Model
if let modelClass = NSClassFromString("MomentsListInfoModel") as? NSObject.Type,
let selector = NSSelectorFromString("modelWithDictionary:") as Selector?,
modelClass.responds(to: selector) {
let modelObj = modelClass.perform(selector, with: data?.data)?.takeUnretainedValue()
// 使 KVC 访
if let model = modelObj as? NSObject {
let dynamicList = model.value(forKey: "dynamicList") as? NSArray ?? NSArray()
let nextID = model.value(forKey: "nextDynamicId") as? String ?? ""
completion(dynamicList, nextID)
return
}
if code == 200, let dict = data?.data as? NSDictionary {
// dictionary
if let listArray = dict["dynamicList"] as? NSArray {
// MJExtension Swift NSMutableArray
let modelsArray = MomentsInfoModel.mj_objectArray(withKeyValuesArray: listArray)
let nextID = dict["nextDynamicId"] as? String ?? ""
// NSMutableArray NSArray OC
completion(modelsArray as? [MomentsInfoModel] ?? [], nextID)
} else {
completion([], "")
}
//
completion(NSArray(), "")
} else {
failure(Int(code), msg ?? "请求失败")
}

View File

@@ -87,7 +87,7 @@
@kWeakify(self);
[self.api fetchLatestMomentsWithNextID:self.nextID
completion:^(NSArray<MomentsInfoModel *> *list, NSString *nextMomentID) {
completion:^(NSArray<MomentsInfoModel *> * _Nonnull list, NSString * _Nonnull nextMomentID) {
@kStrongify(self);
[self endLoading];
if (list.count > 0) {
@@ -107,7 +107,7 @@
[self.tableView.mj_footer endRefreshing];
}
}
} failure:^(NSInteger code, NSString *msg) {
} failure:^(NSInteger code, NSString * _Nonnull msg) {
@kStrongify(self);
[self endLoading];
// TODO: