Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6629827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:18:57+00:00 2026-05-25T22:18:57+00:00

I am able to get the deviceToken in the below method, now I want

  • 0

I am able to get the deviceToken in the below method, now I want to know how to register the deviceToken for push notification,because I am not sure after getting the device token which method or API is used to register the device token for Push Notification and how this registration process works?

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    NSLog(@"APN device token: %@", deviceToken);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:18:59+00:00Added an answer on May 25, 2026 at 10:18 pm

    Well, to start I want to make sure that if you are running the following in the registerForRemoteNotificationTypes when the app launches. Here is what you can add to your AppDelegate

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {       
    
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
                    (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
    
        self.window.rootViewController = self.tabBarController;
    
        [self.window makeKeyAndVisible];
    
        return YES;
    }
    
    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    
        // Send the deviceToken to server right HERE!!! (the code for this is below)
    
        NSLog(@"Inform the server of this device  token: %@", deviceToken);  
    }
    
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
        // Place your code for what to do when the ios device receives notification
        NSLog(@"The user info: %@", userInfo);
    }
    
    
    - (void)application:(UIApplication *) didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
        // Place your code for what to do when the registration fails
        NSLog(@"Registration Error: %@", err);
    }
    

    When you mention registering the device token for push notification you have to send the deviceToken to you server that is sending the push notifications and have the server save it in the database for the push. Here is an example of how you can send this to your server.

    NSString *host = @"yourhost";
    NSString *URLString = @"/register.php?id=";
    URLString = [URLString stringByAppendingString:id];
    URLString = [URLString stringByAppendingString:@"&devicetoken="];
    
    NSString *dt = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
        dt = [dt stringByReplacingOccurrencesOfString:@" " withString:@""];
    
    URLString = [URLString stringByAppendingString:dt];
    URLString = [URLString stringByAppendingString:@"&devicename="];
    URLString = [URLString stringByAppendingString:[[UIDevice alloc] name]];
    
    NSURL *url = [[NSURL alloc] initWithScheme:@"http" host:host path:URLString];
    NSLog(@"FullURL=%@", url);
    
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    
    NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    

    if you need anymore help I will be happy to help. Contact me on either website: Austin Web and Mobile Guru or Austin Web Design

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not able to get html from a very simple XML file as below.
I am not able to get value of a row because is giving Object
I am working on iphone push notification. I can able to get my device
I am not able to get my jwysiwyg and Jhtmlarea text editors to work
Not able to get a clear distinction between these concepts that are used very
i'm not able to get the id of the div field where the radio
I am not able to get much information about dynamic loading of DLL files
After I was able to get it (open id library) installed properly, I am
I have used the following code to register my app to receive push notification,
I'm able to get the value in the image tag (see XML below), but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.