0

This is my first post on here so be nice :) I am new to coding iOS and currently coding an app which uses a login system which communicates with the server and saves a users UDID. I need to app to check the UDID is on the server and if it matches to auto fill the Username UITextField in the login form.

Please could someone help me out or point me in the right direction.

DBD
  • 23,075
  • 12
  • 60
  • 84
SirL0fty
  • 55
  • 1
  • 8
  • 2
    One thing to be aware of is that Apple is phasing out access to UDID so it might be a bad idea to attempt to use it if you want your app to work in the future. This feature will be gone in IOS 5. Read more here: http://techcrunch.com/2011/08/19/apple-ios-5-phasing-out-udid/ – Delete Aug 29 '11 at 19:12
  • I agree with ScanPlayGames, you might want to consider looking into the new identification system apple is going to implement in place of the UDID identification system. – bmeulmeester Aug 29 '11 at 19:18

4 Answers4

2

Mike

Welcome to SO.

I assume you know how to get the UDID? If not, you get it as this

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

Send this to your server (where you have a table with UDIDs and corresponding user information). Using PHP (or whatever language you are using), check if there is an entry for this UDID on the server. If yes, get the corresponding username and set it in the text field as

[textField setText:theUserName];

If you don't know how to send requests and get response from iOS apps, ASIHTTPRequest would be a good and easy way to begin.

If you need any other specific help, I would suggest updating the question.

lostInTransit
  • 70,519
  • 61
  • 198
  • 274
1

Welcome to both iOS and Stackoverflow!

You could build a PHP service which would verify the UDID of your device and check if this device and username are already registered at your site, asuming you are keeping track of these registrations using a MySQL database, PHP could most certainly do the trick.

After verifying the existence of this device, you could use a JSON callback to send the UDID of the device to the iPhone.

As for parsing this JSON check out SBJSONParser.

It might be hard to pull this off in 2 languages, asuming you are new to both. This task is possibly completed in more secure or easier methods, but this might be a consideration to check every part of web communication that the iPhone has to offer

Good luck!

Bryan

bmeulmeester
  • 1,117
  • 12
  • 26
1

Mike, Apple will be phasing out UDID so you should really look at a new approach to this. I would suggest a combination of app.domain and the device MAC number.

Then, have your app talk to your server using HTTPRequest and return the data as JSON and parse that on the app side.

Will Roberts
  • 309
  • 3
  • 12
  • http://stackoverflow.com/questions/677530/how-can-i-programmatically-get-the-mac-address-of-an-iphone - This is a good place to start to get the MAC Address! – Will Roberts Aug 29 '11 at 19:28
  • Consider the github solution https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 I referenced in my answer below as well. It uses the MAC address and the app bundle identifier to create a unique UUID. – Sam Aug 30 '11 at 21:31
0

GitHub already has a solution to UIDevice uniqueidentifier being dropped: https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5

Project Description:

Description

Apple stopped supporting a unique identifier for iOS. This source code solves the problem. It generates a unique identifier based on the mac address of the device in combination with the bundle identifier.

What you need to do:

copy NSString+MD5Addition and UIDevice+IdentifierAddition to your project.

use [[UIDevice currentDevice] uniqueDeviceIdentifier] to retrieve the unique identifier or

use [[UIDevice currentDevice] uniqueGlobalDeviceIdentifier] to retrieve a global unique identifier (used for tracking between different apps).

have fun and follow twitter.com/gekitz ;)

//Thanks to Erica Sadun for her UIDevice+Hardware Addition (used for the mac address retrieval).

Sam
  • 26,946
  • 12
  • 75
  • 101