2

My iOS app has a need to uniquely identify each device so it can retrieve files that it has uploaded to the server with as little user interaction as possible (IE we don't want the user to have to have a username and password). With the release of iOS5, apple has deprecated the UDIDs which would have been the easiest way to go about this. The other way would be to generate and store an identifier on the device and read it from there every time. However, apple could at any time delete the files because they feel there isn't enough free space on the device.

Is there a way to store a device identifier on the local filesystem without worrying about apple "cleaning" it for me?

Or if there's not, how would I go about generating a device identifier that would be the same for one device no matter how many times I generated it but still different from all other identifiers?

nick
  • 2,833
  • 3
  • 34
  • 61

1 Answers1

1

You can use the Wireless NIC's MAC Address as the unique identifier.

Also, any files in the Documents directory will not be wiped by apple and will be sync'ed via iCloud. Apple says all generated content should NOT go in the Documents directory (at least if it can be regenerated).

To get the MAC Address I used code from this post: How can I programmatically get the MAC address of an iphone.

Community
  • 1
  • 1
Sam
  • 26,946
  • 12
  • 75
  • 101
  • You should also check out https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5, which is a solution specifically aimed at solving the deprecation of the device id form iOS5. It uses the MAC Address in conjunction with your app's bundle identifier to create a GUID. – Sam Mar 19 '12 at 15:58
  • is that something that would make apple deny my app from the app store? – nick Mar 19 '12 at 15:58
  • As far as I know it shouldn't. I actually have an app on the app store that uses the MAC Address of devices. I'm sure there are other apps that also use it. – Sam Mar 19 '12 at 16:00
  • Alright sounds great. I'll give it a shot and hope for the best. – nick Mar 19 '12 at 16:04