简体   繁体   English

推送通知不起作用

[英]Push notifications doesn't work

I am developing app with push notification via azure at backend. 我正在开发通过azure在后端进行推送通知的应用程序。 I was following this tutorial . 我正在关注本教程 Everything was fine, I have tested push notification in developer mode, then I send my app to TestFlight. 一切都很好,我已经在开发人员模式下测试了推送通知,然后将应用程序发送到TestFlight。 I generated production certificate and add it to azure admin panel, but push notifications didn't work. 我生成了生产证书并将其添加到Azure管理面板中,但推送通知不起作用。 The strange thing is that push notifications didn't work on iPhone6 with iOs9, but works fine on iPhone5s with iOs9. 奇怪的是,推送通知在使用iOs9的iPhone6上不起作用,但是在使用iOs9的iPhone5s上可以正常工作。 I have also tested iPhone6 device in developer mode and it didn't work too. 我还以开发人员模式测试了iPhone6设备,但它也无法正常工作。 I have no idea whats wrong. 我不知道怎么了 Here are some facts that maybe will help to understand whats wrong: 以下是一些事实,可能会有助于您理解问题所在:

1) Works fine on iOs9 + iPhone5s, doesnt work on iOs9+iPhone6 (in developer and production mode); 1)在iOs9 + iPhone5s上工作正常,在iOs9 + iPhone6上不工作(在开发人员和生产模式下);

2) Looks like the problem is not in certificates, bcs all works fine on iPhone5s; 2)看来问题不在证书中,bcs在iPhone5s上都可以正常工作;

3) In developer mode (when I am using iPhone6) there is no error in device registration in azure PNS , but didReceiveRemoteNotification method just don't called. 3)在开发人员模式下(当我使用iPhone6时),在Azure PNS中的设备注册没有错误,但是didReceiveRemoteNotification方法只是不被调用。

Maybe some1 have idea whats wrong? 也许有人知道怎么了? Below is my AppDelegate mode: 以下是我的AppDelegate模式:

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
   let hub = SBNotificationHub(connectionString: "***", notificationHubPath: "***")
    hub.registerNativeWithDeviceToken(deviceToken, tags: NSSet(array: [String(Api.guid)]) as Set<NSObject>) { (error) -> Void in
        if (error != nil) {
            // handle error
        } else {
            // success
        }
    }
}


func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
    // TODO receive notification when app is launched
}

看来该bug出现了,我在同一设备上使用了一个Apple ID(当我从试飞下载应用程序时)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM