【发布时间】:2013-11-07 05:09:43
【问题描述】:
我有一个基于 IOS 平台构建的 PhoneGap 3.0 应用。
我在AppDelegate.m 的didFinishLaunchingWithOptions 方法中添加了以下两行,以尝试欺骗特定的用户代理(在查看了许多 SO 问题之后):
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"my custom user agent", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
当我在 IOS 模拟器中运行应用程序并检查 navigator.userAgent 时,我得到了预期的“我的自定义用户代理”作为输出。
当我进行远程 phonegap 构建时,在我的 iPhone 上运行应用程序并检查 navigator.userAgent,我得到的是标准 iPhone 用户代理,而不是我的自定义用户代理。
为什么我在模拟器和我的设备上从 navigator.userAgent 得到不同的输出?
相关的 SO 问题:
【问题讨论】:
标签: ios iphone objective-c cordova