2012-04-05 60 views
2

已棄用Udid - 您現在將如何爲每個設備存儲推送通知的設置?nomore UDID - 如何存儲每個設備的推送通知設置?

其他人如何存儲每個設備的推送設置?

我們可以使用iphone/ipad MAC地址嗎?或將蘋果禁止該應用程序?

+4

我投票關閉這一問題作爲題外話,因爲它是關於蘋果的排斥政策。另請參閱:[爲什麼我們不是您最喜愛的公司的客戶支持](https://meta.stackoverflow.com/questions/255745/why-were-not-customer-support-for-your-favorite-company)。 – FelixSFD 2017-05-08 13:47:57

回答

2

像這樣:

@interface UIDevice (UIDeviceAppIdentifier) 
@property (readonly) NSString *deviceApplicationIdentifier; 
@end 

@implementation UIDevice (UIDeviceAppIdentifier) 
- (NSString *) deviceApplicationIdentifier 
{ 
    static NSString *name  = @"a string identifying your application, like its name"; 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    NSString  *value = [defaults objectForKey: name]; 

    if (!value) 
    { 
     value = (NSString *) CFUUIDCreateString (NULL, CFUUIDCreate(NULL));  
     [defaults setObject: value forKey: name]; 
     [defaults synchronize]; // handle error 
    } 
    return value; 
} 
@end 

iOS的文檔或多或少描述使用CFUUIDCreate的()來創建的標識符並使​​用UserDefaults存儲它暗示。