iOS Development: How can I force a UIWebView to load the non-mobile version of Facebook?

前端 未结 2 1647
庸人自扰
庸人自扰 2021-02-13 13:05

I\'m diving into iOS development and when I try to load a specific Facebook Fan Page in a UIWebView, it loads the mobile version of the site, which only loads the wall of the Fa

2条回答
  •  孤独总比滥情好
    2021-02-13 13:54

    Facebook is most likely analyzing the user agent to determine which version to serve. If this is the case then changing the user agent to a desktop browser user agent would cause facebook to change which page version is served. You can change the user agent on NSMutableURLRequest like so:

    [request setValue:@"some-user-agent" forHTTPHeaderField:@"User_Agent"];
    

提交回复
热议问题