0

我如何将 UUID 或某种唯一 ID 添加到 xcode 中的 URL 中?

[Launch loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://somewebsite.com/app/launch.php?&edit&uuid="]]];

谢谢!

4

3 回答 3

2

试试这个

NSString* uuid = [[UIDevices currentDevice] uniqueIdentifier];
NSString* StringUrl =[NSString stringWithFormat: @"http://somewebsite.com/app/launch.php?&edit&uuid=%@", udid ];

[Launch loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: StringUrl]];
于 2012-06-11T15:44:29.750 回答
0

UUID 是指与设备相关的唯一标识符,还是只是唯一的 GUID?

以下链接可帮助您创建与设备无关的唯一 UUID 或 GUID:

http://blog.ablepear.com/2010/09/creating-guid-or-uuid-in-objective-c.html

而且,这是您的代码,已更新为设备 UDID 中的格式:

NSString* udid = [[UIDevices currentDevice] uniqueIdentifier];

[Launch loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: [NSString stringWithFormat: @"http://somewebsite.com/app/launch.php?&edit&uuid=%@", udid ]]];

但是请注意,uniqueIdentifier 已被弃用,Apple 不会接受使用它的应用程序。您可以改为使用 OpenUDID 创建的标识符: https ://github.com/ylechelle/OpenUDID

于 2012-06-11T15:36:38.120 回答
-1

Apple 不再允许开发人员使用 UDID。但是,据说他们今天发布了一个替代方案,因此开发人员仍然可以收集分析数据,请参阅http://www.macrumors.com/2012/06/08/apple-to-launch-new-app-usage-tracking-tools -for-developers-to-balance-user-privacy/

于 2012-06-11T15:35:43.113 回答