如何确定iOS应用程序的HTTP请求的User-Agent? [英] How can I determine the User-Agent for an iOS application's HTTP request?
问题描述
我有一个iOS应用程序,可以使用以下命令下载xml文件:
I have an iOS application that downloads an xml file using:
NSURL *queryURL = [NSURL URLWithString:query];
NSData *xmlData = [[NSData alloc] initWithContentsOfURL:queryURL];
此呼叫是针对第三方的,因此我无法控制服务器。第三方需要知道该用户代理是什么(他们正在根据用户代理优化Feed)
The call is made to a third-party, so I'm not in control of the servers. The third party needs to know what that user-agent is (they are optimizing the feed based on the user-agent)
我的问题是如何确定我的用户-agent是?我没有专门设置它在文档中没有找到任何内容。
My question is how can I determine what my user-agent is? I don't specifically set that anywhere and didn't find anything in the documentation.
推荐答案
它与名称有关你的应用程序(包标识符)。最后,我写了一个快速方法来调用我可以控制的Web服务器,启动应用程序,然后从该Web服务器读取日志,我可以看到确切的用户代理信息。
It has to do with the name of your app (bundle identifier). In the end I just wrote a quick method to call a web server I do have control of, launched the app, and then read the logs from that web server and I could see the exact user-agent information.
这篇关于如何确定iOS应用程序的HTTP请求的User-Agent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!