转载自:https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5
| Classes | a year ago | |
| UIDeviceAddition.xcodeproj | 2 years ago | |
| UIDeviceAddition | 2 years ago | |
| README.markdown | 9 months ago | |
| license | a year ago |
Description
Apple stopped supporting a unique identifier for iOS. This source code solves the problem. It generates a unique identifier based on the mac address of the device in combination with the bundle identifier.
What you need to do:
-
copy
NSString+MD5AdditionandUIDevice+IdentifierAdditionto your project. -
if your are using ARC in your project, you have to add the
-fno-objc-arcflag to both files. Apple ARC Guidelines -
use
[[UIDevice currentDevice] uniqueDeviceIdentifier]to retrieve the unique identifier (it's a hash of your Bundle ID + MAC address) -
use
[[UIDevice currentDevice] uniqueGlobalDeviceIdentifier]to retrieve a global unique identifier (it's a hash of the MAC address, used for tracking between different apps). -
have fun and follow gekitz ;)
//Thanks to Erica Sadun for her UIDevice+Hardware Addition (used for the mac address retrieval).
License
see license file.
本文介绍了一个开源项目,用于解决苹果停止支持iOS设备唯一标识符的问题。通过组合设备的MAC地址和应用包标识符,该项目生成了一个独特的设备标识符,可用于跟踪不同应用程序之间的数据。包括如何在项目中使用代码片段、获取唯一标识符的方法以及遵循Apple ARC指南的注意事项。
4511

被折叠的 条评论
为什么被折叠?



