簡體   English   中英

從蘋果推送通知服務向服務器發送設備令牌

[英]send device token to server from apple push notification service

我正在研究蘋果推送通知服務。 現在我已經按照蘋果 APNS 指南中的建議實現了委托方法。 但這也說明必須將從 APNS 收到的設備令牌發送到提供者服務器。

我真的很困惑這件事。

因為當我啟動應用程序時,它問我是否要注冊遠程通知,但后來它從未顯示過類似的內容。 當時我沒有代碼來處理這個設備令牌。 但是現在即使我刪除並重新安裝了整個應用程序,它也不會顯示類似的內容。

任何幫助將不勝感激。 我的代碼是這樣的

- (void)viewDidLoad {
    [super viewDidLoad];
    //registring for remote notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)];
}


- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    NSLog(@"Device token is %@", deviceToken)
}

注冊通知的消息僅在第一次安裝時顯示一次。 要更改通知設置,您可以進入通知設置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM