2016-08-09 7 views
0

私は私のアプリを実行すると、この例外が返りこここのスレッドを修正するには1 exc_bad_instruction(code = exc_i386_invop subcode = 0x0)?

のセクション内の項目の数で発生するが、私のコードです:のUIViewController、UICollectionViewDataSource、: 輸入SwiftyJSON

クラスDetailPage Alamofire

import UIKit 

インポート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; 

} 

とmy collectionView f unds:

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 
    } 

} 

} 
+0

エラーメッセージはかなり明白です:Firebaseプロジェクトのgoogle-services.jsonを '/ Users/ismail/AndroidStudioProjects/BusTrackingApp/app'に置く必要があります。 –

答えて

4

あなたのプロジェクトにはgoogle-services.jsonファイルがありません。 docsをチェックして生成方法を決定し、BusTrackingApp/appフォルダーに追加してください。

関連する問題