首页 > 解决方案 > 我应该为自己的网络浏览器使用哪个用户代理?

问题描述

我目前正在使用这个:

#define CUSTOM_USER_AGENT_IPHONE = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14F89 Safari/602.1"

我认为这已经过时了。我应该如何去更新这个?每当用户代理更改为更新版本时,我是否应该向 App Store 提交更新版本的 Web 浏览器应用程序?

webView.customUserAgent = self.customUserAgent;

- (NSString *)customUserAgent {
    
    // Checking interface idiom for the appropriate user agent string.
    
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        
        return @CUSTOM_USER_AGENT_IPHONE;
    }
    else {
        
        return @CUSTOM_USER_AGENT_IPAD;
    }
}

标签: objective-cwkwebviewuser-agent

解决方案


推荐阅读