带有django ios通知的APN

带有django ios通知的APN,ios,objective-c,apple-push-notifications,Ios,Objective C,Apple Push Notifications,我第一次尝试为我的应用程序设置APN,但遇到了一个关于如何设置与特定设备id关联的用户的问题。我正在阅读以下内容: 我能够完成所有的设置和一切,我正试图为iOS应用程序编写代码。我的问题是,我的iOS应用程序中有以下示例: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIRemoteNotificationT

我第一次尝试为我的应用程序设置APN,但遇到了一个关于如何设置与特定设备id关联的用户的问题。我正在阅读以下内容:

我能够完成所有的设置和一切,我正试图为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];
}
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
UIRemoteNotificationType allowedNotifications=UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge;
[[UIApplication sharedApplication]registerForRemoteNotificationTypes:allowedNotifications];
返回YES;
}
-(无效)应用程序:(UIApplication*)应用程序DIdRegisterForRemotionTificationswithDeviceToken:(NSData*)deviceToken
{
NSString*tokenAsString=[[[deviceToken描述]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@”“]
StringByReplacingOfString:@“和字符串:@]”发生;
NSURL*url=[NSURL URLWithString:[NSString stringWithFormat:@]http://your_server.com/add_device_token/%@/“,tokenAsString]];
NSMutableURLRequest*请求=[[NSMutableURLRequest alloc]initWithURL:url];
[NSURLConnection connectionWithRequest:request委托:self];
}

这将允许我通知服务器该特定设备的令牌。然而,我的应用程序要求用户登录,并且在登录后,他们有用户id、电子邮件、密码等。有没有办法在用户登录后延迟所有这些?或者这是我在发布时必须做的事情吗?

答案似乎是否定的。最好是让appDelegate记住设备已登录,然后稍后(登录后等)发送该设备的用户注册信息