在我的應用程序,我用的是以下類型的代碼與用戶代理渣土:(iOS)請問我的User-agent會拒絕我的應用程序嗎?
// Fake Firefox's user agent during web service's registration
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Mozilla/5.0 (compatible; Windows; U; Windows NT 6.2; WOW64; en-US; rv:12.0) Gecko/20120403211507 Firefox/12.0", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
// Return to standard iOS user agent when web service registration is done
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
我的應用程序的一部分,用戶可以使用Web服務註冊其「註冊一個帳戶」頁面,也是唯一可以阻止其網站自動啓動「下載我們的APP INSTEAD!」頁面的方法。就是要用這個用戶代理字符串來彌補。我已經嘗試在NSMutableURLRequest
中設置用戶代理,但我沒有得到這個工作。 (是的,我曾嘗試在NSMutableURLRequest
中設置「User-Agent」和「User_Agent」。)
我聽說這可能會讓您的應用程序被Apple拒絕。任何人都可以確認或否認,或提供任何評論?謝謝!
谷歌瀏覽器做它我認爲在iOS上,因爲你可以要求桌面版本的網站。 – jrtc27
爲什麼假冒Firefox?爲什麼不直接說「MyApp 1.0」等? – nielsbot