-(void) Modifyua
{
ID webview = [uiwebviewinstance valueforkeypath:@ "_internal.browserview._webview"];
[WebView performselector: @selector (setcustomuseragent:) withobject:@ "mozilla/5.0 (Windows; U Windows NT 5.2) applewebkit/525.13 (khtml, like Gecko) chrome/0.2.149.27 safari/525.13 "];
}
This is an example of modifying the user Agent. To get WebView using the Key-value coding method
To get through Apple's review more securely, you can do this:
-(void) Modifyua
{
NSString *path = [@ "_internal.browser" stringbyappendingstring:@ "View._webview"];
ID webview = [g_webview Valueforkeypath:path];
NSString *selstring = [@ "Setcustom" stringbyappendingstring:@ "useragent:"];
Sel sel = nsselectorfromstring (selstring);
[WebView Performselector:sel withobject:@] mozilla/5.0 (Windows; U Windows NT 5.2) applewebkit/525.13 (khtml, like Gecko) chrome/0.2.149.27 safari/525.13 "];
}
Split the string and then the achievement OK
Source: http://blog.csdn.net/hursing