本文介绍了iOS7 - 设备唯一标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的iOS应用程序适用于特定用户。因此,我们使用设备唯一标识符进行用户识别。这种方法适用于iOS 6,因为我们每次都获得相同的价值。

Our iOS application is for specific users. So, we used device unique identifier for user identification. This approach works fine till iOS 6, because we are getting same value every time.

NSString *strUniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];

在iOS 7中,上述方法重新调整了不同的值,我们在用户识别方面遇到了问题。 iOS 7 apis提供以下备用。

In iOS 7, above method is retuning different values and we are getting issues in user identification. iOS 7 apis provide following alternate.

NSUUID *oNSUUID = [[UIDevice currentDevice] identifierForVendor];
[strApplicationUUID setString:[oNSUUID UUIDString]];

我用identifierForVendor替换了uniqueIdentifier,并创建了Ad hoc构建。在iOS 7和iOS 6设备上安装构建。在iOS 7中,到目前为止,我每次都获得相同的值,但是当我们删除并重新安装应用程序时,iOS 6每次都会给出不同的值。

I replaced "uniqueIdentifier" with "identifierForVendor", and created Ad hoc build. Installed build on both iOS 7 and iOS 6 devices. In iOS 7, so far, i am getting same value every time, but iOS 6 gives different values every time, when we delete and reinstall app.

目前应用程序不是在App Store上可用。所以我不确定这个API如何适用于App store构建。

Currently application is not available on App store. So i am not sure how this api works for App store build.

问题:
1)对于appstore app,identifierForVendor返回相同的iOS值每次7?或者将来用户删除并重新安装应用程序时可能会更改?
2)iOS 7 apis中的唯一标识符是否可以使用其他替代方法,它们为iOS 6和7返回相同的值?
3)任何其他建议...

Questions:1) For appstore app, is "identifierForVendor" return same value for iOS 7 every time? or it may change when user delete and reinstall app in future?2) Is any other alternative available for "unique identifier" in iOS 7 apis, which return same values for both iOS 6 and 7?3) Any other suggestions...

推荐答案

您应该考虑识别和授权用户而不是设备的策略。取决于特定于设备的标识符,防止授权用户在没有某种管理员交互的情况下切换设备,并允许非授权用户在他们碰巧找到/窃取/借用授权设备时进行访问。您可以依靠用户凭据而不是设备标识符来避免这些问题。

You should consider strategies for identifying and authorizing the user instead of the device. Depending on a device-specific identifier prevents authorized users from switching devices without some sort of administrator interaction, and allows non-authorized users access if they happen to find/steal/borrow an authorized device. You can avoid these problems by relying on user credentials instead of device identifiers.

这篇关于iOS7 - 设备唯一标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 11:52