Ernesto
Ernesto

Reputation: 1592

How can I explicitly define the UDID of the iPad simulator when running my app from XCode?

I'm new to iPad development and I'm trying to debug an app that connects to Google App Engine, and all the connection is based on is the UDID of the device which we register in the server.

So if I debug the app on the iPad, it works fine because the iPad's UDID is registered in the server, but when debugging from emulator I have no idea what the UDID is, so I cannot register it beforehand. Is there a way to set the UDID in XCode when I run the emulator?

Upvotes: 1

Views: 973

Answers (1)

Noah Witherspoon
Noah Witherspoon

Reputation: 57149

Nope. The simulator generates its own UDID. Just alter your code so that the methods that use the UDID use a different value if it’s running on the simulator. I.e.:

#ifndef TARGET_IPHONE_SIMULATOR
    NSString *udid = [UIDevice currentDevice].uniqueIdentifier;
#else
    NSString *udid = @"some-test-udid";
#endif

Note, however, that Apple is deprecating access to the UDID, so you should start looking for alternatives.

Upvotes: 1

Related Questions