Latest 0.3.1
Homepage https://github.com/kaunteya/APNSwift
License MIT
Platforms ios 9.0, osx 10.10, requires ARC
Authors

HTTP/2 Apple Push Notification Service (APNs) push provider written in Swift

Cocoapods Compatible
Platform
License

Features

  • Sends notification using new HTTP/2 protocol
  • Send notifications iOS, tvOS and macOS apps

Installation

CocoaPods

CocoaPods adds supports for Swift and embedded frameworks.

To integrate APNSwift into your Xcode project using CocoaPods, specify it in your Podfile:


pod 'APNSwift'

Usage

APNS Connection can be created by 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, options: apnsOptions)

Push Notification options

var apnsOptions = APNS.Options()
apnsOptions.topic = "Weekend deal"
apnsOptions.port = .p2197
apnsOptions.expiry = NSDate()
apnsOptions.development = false

Push

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)")
    }
}

Latest podspec

{
    "name": "APNSwift",
    "version": "0.3.1",
    "license": "MIT",
    "summary": "HTTP/2 based APNS provider written in Swift",
    "homepage": "https://github.com/kaunteya/APNSwift",
    "authors": {
        "Kaunteya Suryawanshi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kaunteya/APNSwift.git",
        "tag": "0.3.1"
    },
    "platforms": {
        "ios": "9.0",
        "osx": "10.10"
    },
    "requires_arc": true,
    "source_files": "Source/*.swift"
}

Pin It on Pinterest

Share This