iOS 不同设备的不同操作

iOS different action with different devices

我正在使用 BLE 4.0 编写 iOS 应用程序,Xcode 6。

涉及许多 iPod (5 Touch) 和一个传感器。想象一下,iPod 在一个大房间里的玩具火车轨道上转动。

当 iPod 1 靠近传感器并连接到它时,它需要上传一条消息:"Hello I am iPod 1"。

当 iPod 2 经过传感器并与其连接时,它需要上传一条信息:"Hello I am iPod 2"。

你懂的。

我用 1 部 iPod 轻松搞定。现在我的问题是,如何区分所有 iPod? iPod 1 或 iPod 2 无关紧要,我只需要一种方法来为它们中的每一个分配不同的值,以便当它们在通过传感器时上传此值时,我知道哪个 iPod 在那里。

显然所有 iPod 上都将使用完全相同的应用程序,因为我不想维护 25 个不同的应用程序。

据我所知,Apple 不允许使用 UDID 甚至 Mac 地址。我什至不关心这些数字,我只需要找到让它们与众不同的东西。

你认为我的选择是什么?一定有办法区分一堆 iPod 吗?

我真的很想以正确的方式来做,但最坏的情况是,这是一个 "in-house" 应用程序,永远不应该进入应用程序商店,所以即使它会让我们被 Apple 拒绝,我很乐意看一看。

提前感谢您的任何想法。干杯。

UIDevice class 具有以下内容(引用自文档):

@property(nonatomic, readonly, retain) NSUUID *identifierForVendor

Discussion

The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.