Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何制作;将浏览器标识为";在iOS中_Objective C_Ios_Cocoa Touch_Browser_Identify - Fatal编程技术网

Objective c 如何制作;将浏览器标识为";在iOS中

Objective c 如何制作;将浏览器标识为";在iOS中,objective-c,ios,cocoa-touch,browser,identify,Objective C,Ios,Cocoa Touch,Browser,Identify,我正在为iOS(iPad)编写一个浏览器,我想知道如何设置一个用户设置,使浏览器看起来像Safari桌面、Firefox等(我是初学者)谢谢 NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"custom user agent", @"UserAgent", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:dictionar

我正在为iOS(iPad)编写一个浏览器,我想知道如何设置一个用户设置,使浏览器看起来像Safari桌面、Firefox等(我是初学者)谢谢

NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"custom user agent", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
[dictionary release];

在创建web视图之前,它可能会起作用。

我刚刚尝试过,但什么也没发生。对于用户代理,我做了
Mozilla/5.0(iPad;U;CPU OS 4_3,如Mac OS X;en us)AppleWebKit/533.17.9(KHTML,如Gecko)Version/5.0.2 Mobile/8F190 Safari/6533.18.5
它仍然像iPhone的Safari浏览器一样工作。请帮忙。谢谢我认为在创建web视图之前运行这些代码是很重要的。因此,如果从nib加载web视图,可能就太晚了。您可以在本文中尝试以下方法: