2016-08-09 4 views
0

Когда я запускаю мое приложение это исключение происходит в ряде пункта в разделе о возвратекак исправить эту тему 1 exc_bad_instruction (code = exc_i386_invop subcode = 0x0)?

вот мой код:

import UIKit 

импорт Alamofire импорт SwiftyJSON

класс DetailPage: 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; 

} 

и мой коллективПрибор 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

Сообщение об ошибке достаточно явное: вам нужно будет поместить google-services.json из проекта Firebase в '/ Users/ismail/AndroidStudioProjects/BusTrackingApp/app'. –

ответ

4

Вам не хватает google-services.json файл в вашем проекте. Проверьте docs, чтобы определить, как его сгенерировать и добавить в папку BusTrackingApp/app.

Смежные вопросы