0
我想第一次爲我的應用程序設置APNS,並有一個關於如何設置與特定設備ID相關聯的用戶的問題。我在閱讀以下內容:APNS與Django的IOS通知
https://github.com/stephenmuss/django-ios-notifications
我能夠做所有的設置和一切,我在那裏我試圖寫的代碼點iOS應用我的問題是,我有以下的按在我的iOS應用實例:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIRemoteNotificationType allowedNotifications = UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:allowedNotifications];
return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString * tokenAsString = [[[deviceToken description]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]]
stringByReplacingOccurrencesOfString:@" " withString:@""];
NSURL* url = [NSURL URLWithString:[NSString stringWithFormat:@"http://your_server.com/add_device_token/%@/", tokenAsString]];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
[NSURLConnection connectionWithRequest:request delegate: self];
}
這將讓我通知我的服務器令牌特定設備。然而,我的應用程序需要用戶登錄,登錄後他們有用戶ID,電子郵件,密碼等。有沒有辦法在用戶登錄後延遲所有這些?或者這是我在推出時必須要做的事情?