I can't add an item

Mission: SERVERLESS 101
Task: Invoke the API Service using generated client SDK

Please, describe your problem here.

HI,

When I invoque on my swift app the addItem function I get an error ( Error: null)

I’d appreciate any clarification you may provide .

Thank you in advance

static func consulta(){
    Backendless.shared.userService.login(identity: "dummyuser@backendless.com", password: "1234567890", responseHandler: { loggedInUser in
        print("User has been logged in")
        getInstructions(responseHandler: { respuesta in
            print(String(describing: respuesta))
            let item = ["name": "Milk", "quantity": 1] as [String : Any]
            addItem(cartName: "mycart", item: item, responseHandler: { respuesta in
                print(String(describing: respuesta))
                getItems(cartName: "mycart", responseHandler: { respuesta in
                    print(String(describing: respuesta))
                    purchase(cartName: "mycart", responseHandler: { respuesta in
                        print(String(describing: respuesta))
                    }, errorHandler: { fault in
                        print("Error: \(fault.message ?? "")")
                    })
                }, errorHandler: { fault in
                    print("Error: \(fault.message ?? "")")
                })
                
            }, errorHandler: { fault in
                print("Error: \(fault.message ?? "")")
            })
        }, errorHandler: { fault in
            print("Error: \(fault.message ?? "")")
        })
        
    }, errorHandler: { fault in
        print("Error: \(fault.message ?? "")")
    })
    
}

Hello @Alejandro_Cuartas_Fernandez,
I’ll check this issue as soon as possible.

Regards,
Olha

I can reproduce this issue. I’ve created an internal ticket BKNDLSS-22416 for this problem.
As a workaround to complete the mission please use this code:

CodelessShoppingCartService.shared.getInstructions(responseHandler: { instructions in
    let item = ["name": "milk", "quantity": 1] as [String : Any]
    CodelessShoppingCartService.shared.addItem(cartName: "myCart", item: item, responseHandler: { addedItem in
    }, errorHandler: { fault in
        CodelessShoppingCartService.shared.getItems(cartName: "myCart", responseHandler: { items in
            CodelessShoppingCartService.shared.purchase(cartName: "myCart", responseHandler: { purchased in
                print("PURCHASED: \(purchased)")
            }, errorHandler: { fault in
                print("Purchase Error: \(fault.message ?? "")")
            })
        }, errorHandler: { fault in
            print("GetItems Error: \(fault.message ?? "")")
        })
    })
}, errorHandler: { fault in
	print("GetInstructions Error: \(fault.message ?? "")")
})

Regards,
Olha

Hello,
This issue is fixed, could you please check with the newest version of Swift-SDK 6.0.2?

Regards,
Olha