Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全局替换baseurl是有问题的 #3

Closed
zzggxx opened this issue Sep 13, 2017 · 6 comments
Closed

全局替换baseurl是有问题的 #3

zzggxx opened this issue Sep 13, 2017 · 6 comments

Comments

@zzggxx
Copy link

zzggxx commented Sep 13, 2017

如题,baseurl中我带有/,后来切换之后请求的参数就是主域名少了一部分,不知道是为什么.

@JessYanCoding
Copy link
Owner

这不符合 Retrofit 定义的 BaseUrl 格式,正确格式如: "https://api.github.com" 后面不能加 "/"

@zhzhh7378
Copy link

长时间后台运行后重新回到主界面设置的全局baseUrl失效

@JessYanCoding
Copy link
Owner

JessYanCoding commented Sep 23, 2017

@zhzhh7378 那你要打断点查看,存放 baseUrl 的容器是否存在,并且是否有值,如果没值,是因为 App 在后台后被系统杀死,导致内存中存放的对象不存在,这些东西都需要你自行去处理,这个情况和框架没有任何关系,你存放任何东西在内存中,都可能在被系统杀死后被销毁

@JessYanCoding
Copy link
Owner

JessYanCoding commented Sep 23, 2017

@zhzhh7378 我最多可以提供给你,当框架完成从 baseUrl 容器中取 DomainName 所映射 baseUrl 操作之前的一个回调,可以在回调中判断容器中所需要的 baseUrl 是否为 Null ,如果为 Null ,则重新

普通 BaseUrl:
RetrofitUrlManager.getInstance().putDomain(String,String); 
全局 BaseUrl:
RetrofitUrlManager.getInstance().setGlobalDomain(String);

只要保证容器中有对应的 baseUrl, 就不会失效

@JessYanCoding
Copy link
Owner

@zhzhh7378 b2863ef

新版本 v1.1.0 已经更新了上面所说的回调

@mybirthfather
Copy link

长时间后台运行后重新回到主界面设置的全局baseUrl失效

我也会失效 你是怎么解决的? clone源码 自己改的么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants