VJVJ VJVJ - 6 months ago 17
Swift Question

Can I show "App" Would like send you notifications alert after event in iOS

I am creating an app with push notifications and facebook login. For push notifications, the alert comes when you open the app, "App" Would like send you notifications. I want to display it after facebook login.

Answer

You can register for push notifications from anywhere in project. In your case you have to register for push notifications after you successfully login user with Facebook. Give a call to registerToReceivePushNotification after login completes and handle delegates in AppDelegate.

Objective C:

#pragma mark - push notificaiton
-(void)registerToReceivePushNotification 
{
    [[UIApplication sharedApplication] registerForRemoteNotifications];
}

Swift:

UIApplication.sharedApplication().registerForRemoteNotifications()