Take your first steps into Alamofire, the de facto networking library on iOS powering thousands of apps, by using the Imagga APIs to upload and analyze user photos.
Hi, I tried the finished project, but it shows an error. I already copy and prepare the authenticationToken. Here’s the error:
Error while uploading file: Optional(Alamofire.AFError.responseValidationFailed(Alamofire.AFError.ResponseValidationFailureReason.unacceptableStatusCode(403)))
I read the following code in ImaggaRouter.swift
public enum ImaggaRouter: URLRequestConvertible {
// 1
enum Constants {
static let baseURLPath = “http://api.imagga.com/v1”
static let authenticationToken = “Basic xxx”
}
The reason I declare them as an enum is because an enum with no cases can’t be instantiated, whereas a struct can be, so using an enum helps avoid this kind of mistake.
First of all, I would like to thank @ron.kliffer for the awesome tutorial!
Imagga’s API v1 will be stopped by the end of November 2018. There is a new API v2 interface which can be used, however, the API interface and the output result are both different.
Replace them with the ones in your project. Once you have replaced them, open ImaggaRouter.swift and replace <YOUR_AUTH_TOKEN_HERE> with the authorization string found in your Imagga user dashboard here: https://imagga.com/profile/dashboard