初めてアプリに APNS をセットアップしようとしていますが、特定のデバイス ID に関連付けられたユーザーを設定する方法について質問がありました。私は以下を読んでいます:
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、電子メール、パスワードなどを持っています。ユーザーがログインした後、これらすべてを遅らせる方法はありますか? それとも、これは私がローンチ時にしなければならないことですか?