iOS different action with different devices

31 views Asked by At

I am writing an iOS app using BLE 4.0, Xcode 6.

There are many iPods (5 Touch) involved and a sensor. Imagine the iPods are on a toy train track turning around in a massive room.

When iPod 1 gets close to the sensor and connects to it, it needs to upload a message : "Hello I am iPod 1".

When iPod 2 passes by the sensor and connects to it, it needs to upload a message : "Hello I am iPod 2".

You get the idea.

I do it easily with 1 iPod. Now my problem is, how can I differentiate between all the iPods ? It doesn't matter who is iPod 1 or iPod 2, I just need a way to assign a different value to each of them so when they upload this value as passing by the sensor, I know which iPod was there.

Obviously exactly the same app will be on all the iPods, as I don't want to maintain 25 different apps.

As far as I know, Apple doesn't allow the use of UDID or even Mac Address. I don't even care about these numbers, I just need to find something that makes them different.

What do you think my options are ? There must be a way to distinguish between a bunch of iPods ?

I really would like to do it the right way but worst case, it's an "in-house" app that shouldn't reach the app store ever, so even if it's something that would get us rejected by Apple, I would happily have a look at it.

Thanks in advance for any idea you might have. Cheers.

1

There are 1 answers

0
Phillip Mills On BEST ANSWER

The UIDevice class has the following (quote from docs):

@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.