Change User Agent in UIWebView

前端 未结 14 1842
孤城傲影
孤城傲影 2020-11-22 17:03

I have a business need to be able to customize the UserAgent for an embedded UIWebView. (For instance, I\'d like the server to respond differently if, say, a user is using

14条回答
  •  名媛妹妹
    2020-11-22 18:02

    This solution seems to have been seen as a pretty clever way to do it

    changing-the-headers-for-uiwebkit-http-requests

    It uses Method Swizzling and you can learn more about it on the CocoaDev page

    Give it a look !

提交回复
热议问题