2017-10-05 58 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)