UIWebView更改UserAgent

NSString *strUserAgent = @"Your UserAgent";


id webDocumentView;

 

id webView;

 

webDocumentView = objc_msgSend(myWebView,@selector(_documentView));

 

object_getInstanceVariable(webDocumentView, "_webView", (void**)&webView);

 

objc_msgSend(webView, @selector(setCustomUserAgent:), strUserAgent);

 

 

更改之后就可以访问:http://whatsmyuseragent.com验证

你可能感兴趣的:(object)