问题原因:
登录成功后获取到的token只缓存到内存中,并没有序列化到本地;这种情况下内存回收token丢失后,访问接口就没有传递token才导致的422 Unprocessable Entity;
The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.
解决办法
登录成功后,应该有一个贯穿App的User全局变量,这个全局变量要支持序列化到本地;在使用时候先从内存中获取,内存中没有再从本地获取(并对内存中赋值);这样数据才不会因为内存回收而丢失;
参考:
状态码