小编Pra*_*kar的帖子

如何在不点击横幅或显示通知之前访问推送通知响应?

我以这种方式在我的应用程序中实现了推送通知

//MARK:- Register notifications

func registerForPushNotifications() {

    if #available(iOS 10.0, *){

        let center = UNUserNotificationCenter.current()
        center.delegate = self
        center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
            if (granted)
            {
                UIApplication.shared.registerForRemoteNotifications()
            }
            else{
                //Do stuff if unsuccessful...
            }
            // Enable or disable features based on authorization.
        }
    }

    else
    {
        //If user is not on iOS 10 use the old methods we've been using
        let types: UIUserNotificationType = [UIUserNotificationType.badge, UIUserNotificationType.alert, UIUserNotificationType.sound]
        let settings: UIUserNotificationSettings = UIUserNotificationSettings( types: types, categories: nil )
        UIApplication.shared.registerUserNotificationSettings( …
Run Code Online (Sandbox Code Playgroud)

push-notification apple-push-notifications ios swift

5
推荐指数
1
解决办法
999
查看次数

如何创建免费的 iOS 开发配置文件

我正在开发一个用于学习目的的应用程序。最近到了现在我可以在设备中测试应用程序而无需支付 99 美元。我对此进行了研发,但未能成功。请让我知道是否有任何办法。谢谢。

ios

0
推荐指数
1
解决办法
3385
查看次数