TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2016 |
SPMSupports SPM | ✗ |
Maintained by Kaunteya Suryawanshi.
HTTP/2 Apple Push Notification Service (APNs) push provider written in Swift
SecIdentity
or PKCS certificate file
guard let apns = APNS(certificatePath: "/path/to/PKCS/certificate", passphrase: "********") else {
//Failed to create APNS object
return nil
}
let apnsConnection = APNS(identity: certificateIdentity)
var apnsOptions = APNS.Options()
apnsOptions.development = true
apnsOptions.port = APNS.Options.Port.p443
try! apnsConnection.sendPush(tokenList: tokens, payload: jsonPayLoad) {
(apnsResponse) in
Swift.print("\n\(apnsResponse.deviceToken)")
Swift.print(" Status: \(apnsResponse.serviceStatus)")
Swift.print(" APNS ID: \(apnsResponse.apnsId ?? "")")
if let errorReason = apnsResponse.errorReason {
Swift.print(" ERROR: \(errorReason)")
}
}