- (void)createNewUserAgent
{
UIWebView* tempWebView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString* userAgent = [tempWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSString *myAgent = [NSString stringWithFormat:@"%@ xxx/%@",userAgent,version];
NSDictionary *dictionnary = [[NSDictionary alloc] initWithObjectsAndKeys:myAgent, @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionnary];
}
iOS开发 创建自己的UserAgent
最新推荐文章于 2021-12-28 16:24:14 发布