2016-08-09 195 views
0

Wenn ich auftritt meine app diese Ausnahme laufen in der Anzahl der Artikel in Abschnitt Rückkehrwie Sie diesen Thread beheben 1 exc_bad_instruction (code = exc_i386_invop subcode = 0x0)?

hier ist mein Code:

import UIKit 

Import Alamofire Import SwiftyJSON

Klasse Detailseite: 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; 

} 

und meine Kollektion 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

Die Fehlermeldung ist ziemlich explizit: Sie müssen die google-services.json aus Ihrem Firebase-Projekt in '/ Users/ismail/AndroidStudioProjects/BusTrackingApp/app' setzen. –

Antwort

4

Sie vermissen google-services.json Datei in Ihrem Projekt. Überprüfen Sie docs, um zu ermitteln, wie es generiert wird, und fügen Sie es dem Ordner BusTrackingApp/app hinzu.