vapor-apns icon indicating copy to clipboard operation
vapor-apns copied to clipboard

sent successfully, but can't get any push message.Lubuntu 16.04

Open carlhung opened this issue 8 years ago • 2 comments

I am running Lubuntu 16.04 on virtual machine. I reinstall whole Lubuntu again. I still got the same result. actually, I reinstalled lubuntu, swift 3.1.1, libcurl4-openssl-dev. then, i compiled the project. and let the module scanned the version of curl and let it update.
I checked the result. sent successfully, but can't get any push message.

    guard var opt = try? Options(topic: "message.share", certPath: "/home/carl/swift/time/pem/crt.pem", keyPath: "/home/carl/swift/time/pem/key.pem"), let vaporAPNS = try? VaporAPNS(options: opt) else {
        send(error: "APN initalised fail.", code: .unknown, to: response)
        return
    }
    opt.forceCurlInstall = true
    let payload = Payload(message: "Your push message comes here")
    let pushMessage = ApplePushMessage(priority: .energyEfficient, payload: payload, sandbox: true)
    let result = vaporAPNS.send(pushMessage, to: token)
    if case let .success(messageId,deviceToken, serviceStatus) = result, case .success = serviceStatus {
        print ("Success!")
    }

// print "Success!"

carlhung avatar Apr 27 '17 13:04 carlhung

I need an error log otherwise I can't really help... By the way message.share is not a valid topic to send notifications to. You need to set that to your app bundle identifier

matthijs2704 avatar Apr 28 '17 14:04 matthijs2704

actually the topic is real. i will change the topic's name in the future. I found that the push notification didn't work as the app didn't open. now the problem is I got the push message when the app opens. but if the app is terminated, I can't get push message. when i use the other tool for testing the push notification. the push notification would work even the app is terminated. thanks.

carlhung avatar Apr 30 '17 09:04 carlhung