Get the products


#1

I’m getting this error , Could you please help me ?

This is my code
( Moltin.sharedInstance().product.listing(withParameters: nil, success: { (response) in
guard let responseDictionary = response as? [AnyHashable : Any] else {
print(“Error: respnonse is empty”)
return
}

        self.objects = (responseDictionary["result"] as? [AnyObject])!
        
        // ...
    }) { (responseDictionary, error) in
        print("something went Wrong")
    }

    
}

)

This is the error (

ERROR GET: https://api.molt.in/v1/products
DATA: {
error = “API V1 is now deprecated. Please use V2, or contact moltin for advice.”;
status = 0;
}
something went Wrong

)


#2

Hey @AbdulrahmanAlnajdi,

Seems like you’re using a older version of Moltin. Try updating to version 3.0 https://github.com/moltin/ios-sdk.

The new syntax looks like this.

self.moltin.product.all { (result) in
    switch result {
      case .success(let response):
        print("Got products: \(response.data)")
      case .failure(let error):
        print("Got failure: \(error)")
    }
  }

Hope this helps!


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.