Do not receive iPhone alert push notification

I am very new to this development, so please help me

I am starting a push notification with this code

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

But on my device, I don’t get a warning notification from the user push notifications that the “Application Name” would like to send notifications

I found that if the device is broken in prison, we do not receive a permission notification, but my device is not broken.

edited

I also get push notifications on my device, just not getting permission warnings on first start.

Any help on this would be truly appreciated.

+5
source share
4 answers

, push- , , . 7 , .

, : , .

, , .

+10

IOS/5.1 +, , S.1 App Store

Apple

, push- push-, iOS , . , , , .

, . , , , , .

+5

- - .

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}

Callback delegate notification method according to your status -

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken 
{

}


- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err 
{
    DebugLog(@"Error in registration. Error: %@", err);
}
0
source

All Articles