Unity iOS token request (Mobile Notifications)

Viewed 116

I can't get a token. This request has infinite execution. It is not possible to receive an error message after the request to start investigating this problem. (Push notifications are enabled in the xCode project)

IEnumerator RequestAuthorization()
{
    var authorizationOption = AuthorizationOption.Alert | AuthorizationOption.Badge;
    using (var req = new AuthorizationRequest(authorizationOption, true))
    {
        while (!req.IsFinished)
        {
            yield return null;
        };
 
        string res = "\n RequestAuthorization:";
        res += "\n finished: " + req.IsFinished;
        res += "\n granted :  " + req.Granted;
        res += "\n error:  " + req.Error;
        res += "\n deviceToken:  " + req.DeviceToken;
        Debug.Log(res);
    }
}

If I disable the "Enable Push Notifications" flag in the "Mobile Notifications Settings" window, the request will be finished, but of course without the received token.

Has anyone encountered a similar problem? If so, how did you solve it?

0 Answers
Related