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

iOS15.4手机关闭24小时制,图片上传时崩溃 #309

Open
alpha-pj opened this issue Apr 6, 2022 · 5 comments
Open

iOS15.4手机关闭24小时制,图片上传时崩溃 #309

alpha-pj opened this issue Apr 6, 2022 · 5 comments

Comments

@alpha-pj
Copy link

alpha-pj commented Apr 6, 2022

大概是因为没有设置NSDateFormatter的locale导致的问题,请看下

@wushuai1415
Copy link
Contributor

崩溃信息是什么

@alpha-pj
Copy link
Author

alpha-pj commented Apr 7, 2022

在OSSModel.m文件的179行报错-[OSSFederationCredentialProvider getToken:],因为上面的NSDateFormatter没设置locale,导致self.cachedToken.expirationTimeInMilliSecond为0了,expirationDate则变为1970;
复现条件:手机时间设置12小时制时区北京,iOS15.4的手机上必现

@wushuai1415
Copy link
Contributor

你修改下sdk的代码看能否解决问题,我这边只有15.4.1的真机,设置12小时制时区北京 没有复现

@alpha-pj
Copy link
Author

alpha-pj commented Apr 7, 2022

给上面的NSDateFormatter设置locale后,就没有问题了,15.4.1也会有这样的问题!
另外你可以试试这段代码,类似OSSModel.m文件166行
NSDateFormatter * fm = [NSDateFormatter new];
[fm setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
int64_t expirationTimeInMilliSecond = [[fm dateFromString:@"2022-04-07T08:16:54Z"] timeIntervalSince1970] * 1000;
我这边这段代码在手机12小时制expirationTimeInMilliSecond值为0,24小时制时数据正常

@wushuai1415
Copy link
Contributor

image
换了个手机还是没有复现,不过这里确实写的不规范,下个版本我会改一下

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

2 participants