为什么会出现编译错误“使用未解决的标识符'saveItemToAlgolia'”

时间:2019-11-30 03:57:57

标签: algolia

enter image description here

if itemImages.count > 0 {
   uploadImages(images: itemImages, itemId: item.id) { (imageLikArray) in
      item.imageLinks = imageLikArray
      saveItemToFirestore(item)
      saveItemToAlgolia(item: item)

      self.hideLoadingIndicator()
      self.popTheView()
   }        
} else {
   saveItemToFirestore(item)
   saveItemToAlgolia(item: item)
   popTheView()
  }
}

//MARK: - Algolia Funcs

func saveItemToAlgolia(item: Item) {

   let index = AlgoliaService.shared.index
   let itemToSave = itemDictionaryFrom(item) as! [String : Any]
   index.addObject(itemToSave, withID: item.id, requestOptions: nil) { (content, error) in

      if error != nil {
        print("error saving to algolia", error!.localizedDescription)
      } else {
        print("added to algolia")
      }
   }
}

0 个答案:

没有答案