简体   繁体   English

Alamofire Framework和iOS证书问题

[英]Alamofire Framework and iOS Certificate issue

I have two iOS dev accounts. 我有两个iOS开发者帐户。 I use my dev account to make tests. 我使用开发者帐户进行测试。 After finishing the development I decided to change the project certificate and set it to client's Apple Dev account. 完成开发后,我决定更改项目证书并将其设置为客户的Apple Dev帐户。

When I use the first one (my Apple account), the requests are made through Alamofire return what expected. 当我使用第一个(我的Apple帐户)时,通过Alamofire发出的请求将返回预期的结果。 But when I set the second certificate I always get errors such as 401 Unauthorized Error. 但是,当我设置第二个证书时,我总是会收到诸如401 Unauthorized Error之类的错误。 I think it sends irrelevant data to the server. 我认为它会将无关的数据发送到服务器。

When I use the built in NSURLSession framework, it works fine on both Apple Dev accounts. 当我使用内置的NSURLSession框架时,它在两个Apple Dev帐户上都能正常工作。 So it is related with certificates and Alamofire but couldn't find the problem for days. 因此,它与证书和Alamofire有关,但是好几天都找不到问题了。

I've tried ServerTrustPolicy for Alamofire instance but didn't help. 我已经为Alamofire实例尝试过ServerTrustPolicy,但是并没有帮助。 Also I've set App Transport Security Settings in the info.plist file, that didn't help as well. 另外,我还在info.plist文件中设置了“应用程序传输安全设置”,但同样没有帮助。

Is there anyone who has experienced this problem? 有没有人遇到这个问题? Thanks. 谢谢。

After trying many things, finally I've decided to clear the XCode cache and now it works without any problem. 在尝试了许多事情之后,最终我决定清除XCode缓存 ,现在它可以正常工作了。 And lesson learned; 并吸取了教训; you should clear cache if you switch between Teams (Apple Dev Accounts) in XCode. 如果您在XCode中的团队(Apple Dev帐户)之间切换,则应清除缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM