未收到IOS推送通知

2024-09-28 01:33:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我配置了我的应用程序:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        let pushSettings: UIUserNotificationSettings = UIUserNotificationSettings(
                forTypes:[.Alert, .Badge, .Sound],
                categories: nil)
            UIApplication.sharedApplication().registerUserNotificationSettings(pushSettings)
            UIApplication.sharedApplication().registerForRemoteNotifications()
        return true
    }

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
        print("My token is: \(deviceToken)");
    }

    // Failed to register for Push
    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
        print("Failed to get token; error: %@", error) //Log an error for debugging purposes, user doesn't need to know
    }

将设备令牌复制到python脚本:

^{pr2}$

我运行这个脚本,它没有返回错误,但我的Ipad上还没有收到通知。我从这个tutorial尝试了php脚本,脚本返回“Message successfully delivered”,但我仍然没有收到任何消息。Php code here。在

你知道怎么调试或者出什么问题了吗?在


Tags: to脚本token应用程序forapplicationerrorfunc

热门问题