Вот тут пишут. Конечно, печально, да. Потому что придется переделывать
Попробуем найти альтернативу.
Для начала посмотрим, что нам послала Apple:
Ага, вот и вся проблема. Генерим 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:
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
Сообщить об опечатке
Текст, который будет отправлен нашим редакторам: