2017-10-05 39 views
0

使用vapor-apns。想做验证。项目编号APNsAuthKey_AQ34EHZCDQ.p8Vaporfrozen-sea-***。但我不知道关键路径。你用什么?哪个keypath需要从Vapor + Heroku发送APN消息?

let options = try! Options(topic: "<your bundle identifier>", teamId: "<your team identifier>", keyId: "<your key id>", keyPath: "/path/to/your/APNSAuthKey.p8") 
let vaporAPNS = try VaporAPNS(options: options) 

在这里发现一个string,但它不工作。

回答

0

如果您尝试引用与Vapor应用程序相关的文件路径,请使用drop.workDir来获取应用程序目录的绝对路径。

let options = try Options(
    topic: "<your bundle identifier>", 
    teamId: "<your team identifier>", 
    keyId: "<your key id>", 
    keyPath: drop.workDir + "/Secrets/APNSAuthKey.p8" 
) 
let vaporAPNS = try VaporAPNS(options: options)