Вот тут пишут. Конечно, печально, да. Потому что придется переделывать :)

Попробуем найти альтернативу.

Для начала посмотрим, что нам послала Apple:

Do not use the uniqueIdentifier property. To create a unique identifier specific to your app, you can call the CFUUIDCreate function to create a UUID, and write it to the defaults database using the NSUserDefaults class.

Ага, вот и вся проблема. Генерим UUID (UDID?) и записываем в NSUserDefaults. Сгенерить можно например так:

+(NSString *) generateUUID

{
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFRelease(uuid);

NSString* newUuid = [(NSString *)uuidString copy];

CFRelease(uuidString);

return [newUuid autorelease];
}

Пример сгенеренной строки:

CAEFED6E-47E8-4021-A367-FE98807D4F14

Ну очень похоже на UDID.

Для пущей уверенности, можно записать в KeyChain, а не в NSUserDefaults. Начать читать о KeyChain можно тут.

Что касается PUSH — для отправки UDID не нужен, ибо после успешной активации PUSH, у UIApplicationDelegate вызывается:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

Вот описание deviceToken:

A token that identifies the device to APS. The token is an opaque data type because that is the form that the provider needs to submit to the APS servers when it sends a notification to a device. The APS servers require a binary format for performance reasons.

Note that the device token is different from the uniqueIdentifier property of UIDevice because, for security and privacy reasons, it must change when the device is wiped.

The delegate receives this message after the registerForRemoteNotificationTypes: method of UIApplication is invoked and there is no error in the registration process. After receiving the device token, the application should connect with its provider and give the token to it. APS only pushes notifications to the application’s device that are accompanied with this token. This method could be called in other rare circumstances, such as when the user launches an application after having restored a device from data that is not the device’s backup data. In this exceptional case, the application won’t know the new device’s token until the user launches it.

Так что убеждаемся, что тут ничего страшного не случилось.

Ссылки:

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html

http://developer.apple.com/library/ios/#DOCUMENTATION/CoreFoundation/Reference/CFUUIDRef/Reference/reference.html#//apple_ref/c/func/CFUUIDCreate

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIDevice_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instp/UIDevice/uniqueIdentifier

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *