[self.client loginCustomerWithCredentials:credentials callback:^(BUYCustomer * customer, BUYCustomerToken * token, NSError * _Nullable error) {
if (customer && !error) {
self.appDelegate.cart = [self.client.modelManager insertCartWithJSONDictionary:nil];
NSLog(@"Success fully loged in token %@ %@",token.accessToken,token.customerID);
UINavigationController *navigationController = self.navigationController;
[navigationController popViewControllerAnimated:YES];
}else{
[self showEror:@"LogIn Failed" message:@"Please provide valid Details"];
}
}];
在成功登录后的上述代码中,我尝试为用户创建购物车。然后我将商品添加到购物车,但当我关闭并重新打开应用程序时,购物车是空的。
如何为用户创建购物车,以便他们能够在任何设备上访问它?