Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show iOS Push Notification Popup? [closed]

I'm trying to add push notification to my app. I need to know how to make the push notification popup appear. The popup I'm pertaining to is an alert view that has two choices, "allow" and "don't allow". It asks the user whether to allow the app to receive notifications and stuff or not.

I've tried deleting my app over and over again and advancing the time but nothing worked.

Also, in case the popup appears, how can I know if the user selected don't allow/ allow?

like image 292
cessmestreet Avatar asked Oct 31 '13 07:10

cessmestreet


People also ask

How can I see notifications on iPhone without opening?

To show the contents of notifications on the Lock Screen without unlocking your device, go to Settings > Notifications > Show Previews, and select Always.

How do I see push notifications again?

Pull down your Notification Shade once and then scroll down to the bottom of your notifications. You should now see a History button (Figure 3). The History button has been added to your Notification Shade. Tap History to access your past 24 hours of notifications (Figure 4).

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.


2 Answers

Resetting the Push Notifications Permissions Alert on iOS

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.

If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:

1. Delete your app from the device.

2. Turn the device off completely and turn it back on.

3. Go to Settings > General > Date & Time and set the date ahead a day or more.

4. Turn the device off completely again and turn it back on.

Source

like image 74
Eran Avatar answered Sep 19 '22 01:09

Eran


Popup appears afrer you register your application for remote notifications. For example:

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

how can I know if the user selected don't allow/ allow?

Application objects calls two delegate's methods:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{

}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *) error
{
}

UPD: Here is tutorial on how to setup your app for push notifications: http://www.raywenderlich.com/32960/

like image 29
Sviatoslav Yakymiv Avatar answered Sep 21 '22 01:09

Sviatoslav Yakymiv