Load webView after clicking allow on SWIFT 3

Asked

Viewed 51 times

1

I have a webView that captures the device token using the firebase library and then sends it to my url via get. Until ai td right, I was able to get the token, and I can send it to the url and in back-end I insert it into database, td quietly, the problem q am having is q the first time q the application is opened after installed it asks my permission to receive notifications, but with that I can’t send the token to the url because the same ñ is generated. Is there any way to call a function after I click allow?

1 answer

0


If the user allows you to receive notifications, you will receive a callback in your Appdelegate, you must implement your code in the following method:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
    // insira seu código aqui
}

If the user does not allow the receipt of notifications, then called method will be:

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
{
    // insira seu código aqui
}

You can read more about the methods in the documentation: Uiapplicationdelegate

Browser other questions tagged

You are not signed in. Login or sign up in order to post.