gpt4 book ai didi

ios - 如何修复线程 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0)?

转载 作者:行者123 更新时间:2023-11-28 10:18:09 27 4
gpt4 key购买 nike

当我运行我的应用程序时,返回部分中的项目数量出现此异常

这是我的代码:

import UIKit

导入Alamofire导入 SwiftyJSON

类详细页面:UIViewController、UICollectionViewDataSource、UICollectionViewDelegate {

@IBOutlet weak var MyOtherProductsOfStoreCollectionView: UICollectionView!
@IBOutlet weak var MySameProductsCollectionView: UICollectionView!


@IBOutlet weak var img1: UIImageView!
@IBOutlet weak var profilePic: UIImageView!
@IBOutlet weak var username: UILabel!
@IBOutlet weak var productsCount: UILabel!
@IBOutlet weak var price: UILabel!
@IBOutlet weak var desc: UILabel!





var sameData:[SameAndOtherData]?
var otherData:[SameAndOtherData]?
var alldata: [PopulerUrunlerData]?
var indexPath: IndexPath?




override func viewDidLoad() {
super.viewDidLoad()

if let indexPath = self.indexPath, let popularUrunlerData = self.alldata?[indexPath.row] {


img1.downloadImage(from: popularUrunlerData.imgUrl!)
profilePic.downloadImage(from: popularUrunlerData.userpic!)
username.text = popularUrunlerData.username
productsCount.text = String( format:"%d", popularUrunlerData.productsCount!)
price.text = String(format: "%.1f", popularUrunlerData.price!)
desc.text = popularUrunlerData.desc




let id = popularUrunlerData.instagramId
let name = popularUrunlerData.username
sameProducts(from: "https://api.shopsta.com/product/\(id!)/similar")
otherProductsOfStore(from: "https://api.shopsta.com/product/\(name!)/\(id!)/others")

}


MyOtherProductsOfStoreCollectionView.delegate = self;
MySameProductsCollectionView.delegate = self;
MyOtherProductsOfStoreCollectionView.dataSource = self;
MySameProductsCollectionView.dataSource = self;

}

和我的收藏查看资金:

  func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

if (collectionView == self.MySameProductsCollectionView){

return (self.sameData?.count)!
}
else {

return (self.otherData?.count)!
}

}




func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

if collectionView == self.MySameProductsCollectionView {

let cella = collectionView.dequeueReusableCell(withReuseIdentifier: "sameProducts", for:
indexPath as IndexPath) as! SameProductsCollectionViewCell
cella.img.downloadImage(from: (sameData?[indexPath.row].image)!)
return cella
}
else {

let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "otherProducts", for: indexPath as IndexPath) as! OtherProductsOfStoreCollectionViewCell
cell.img.downloadImage(from: (otherData?[indexPath.row].image!)!)
return cell
}

}

}

最佳答案

您的项目中缺少 google-services.json 文件。检查docs确定如何生成它并将其添加到 BusTrackingApp/app 文件夹。

关于ios - 如何修复线程 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38853925/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com