2

I am using UUID of current device. I have to send that ID to a server for registering my device.

So I used a bit of code like:

NSString *uuidString = nil;

CFUUIDRef uuid = CFUUIDCreate(NULL);

if (uuid) {
    uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
    CFRelease(uuid);
}

And I am sending that uuidString to the server.

My concern is that Apple will reject my app for using this UUID and sending to a server?

Please give me idea about this, it's Very important for me now.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
sudheer
  • 418
  • 6
  • 20
  • 2
    If you have a developer account, you can download the rules taht Apple (say they) use. What does that document say about using the UUID? – paxdiablo Nov 07 '13 at 08:22
  • can you give me that link for rules Apple use.I have a developer is also – sudheer Nov 07 '13 at 08:23
  • No, because I'm not an Apple developer and therefore they won't let me see it. It'd be nice to see it _before_ signing up but such are the vagaries of the walled garden :-) – paxdiablo Nov 07 '13 at 08:24
  • No, this is basically just a long random number. **UDID** is tied to the device and banned, but **UUID** is just a random number. – borrrden Nov 07 '13 at 08:24
  • Tried to clean up grammar, please check question is still semantically okay. – paxdiablo Nov 07 '13 at 08:35

2 Answers2

5

Why do you think Apple will reject this?

Apple is just not allowing you to identify device any more, by using the UDID or the MAC address of the device.

If you generate a unique number, which you do, then there should be no problem. Just be aware that the UUID you create with the code you posted will be different every time you call the code.

Thus if you use it to track a user then you should generate it once and save the generated UUID somewhere.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • so UUID and UDID both are different.So there is no problem by using UUID right? – sudheer Nov 07 '13 at 08:28
  • 2
    @sudheer, yes they're different but so will be two UUIDs generated with that code on the same device at two different times. If you want an ID to uniquely identify a device, you generate it once and store it, as per rckoenes' suggestion. – paxdiablo Nov 07 '13 at 08:31
  • 1
    Beware of this, and plan for it. If you store it in the keychain it will be fairly safe but it won't survive an OS reinstall from scratch so if that happens your user will lose their ID. – borrrden Nov 07 '13 at 08:34
  • Just out of interest, could you use the Apple ID for this? The one you use for downloading apps and what is, frankly, horrible music from iTunes :-) Or would Apple frown on that as well? Surely that would survive any reinstall (since you'd have to re-enter your exact same Apple ID to get all your apps back). – paxdiablo Nov 07 '13 at 08:36
  • @Daij-Djan what do you mean? Yes the `UDID` is a `UUID`, but it never changes if you reinstall the device. It is like a serial number. The `UDID` looks the save as an `UUID`. But when you create a `UUID` they are unique and should never generate the same one again. – rckoenes Nov 07 '13 at 08:45
  • @paxdiablo,Thanks for replying.I am using UUID only and storing in userdefaults.And i am getting that with a key.Is this is correct way? – sudheer Nov 07 '13 at 08:52
  • @sudheer Yes that should work, but it would be better if you save the created `UUID` in the keychain. – rckoenes Nov 07 '13 at 08:53
  • @paxdiablo,oh ok.Thanks for advice.I have no idea how to do like this.Could you please help on this? – sudheer Nov 07 '13 at 08:58
  • @paxdiablo,Could you please see this question also.Which is asked by me... http://stackoverflow.com/questions/19830496/keyboard-hiding-textfield-in-ipad – sudheer Nov 07 '13 at 09:01
1

Not an anser to the original question I know, but just to point out that there'a NSUUID now so you can avoid all that CF boilerplate.

NSString *uuidString = [[NSUUID UUID] UUIDString];

Mike Pollard
  • 10,195
  • 2
  • 37
  • 46