Skip to content

HTTP/2 Swift APNS library for notification provider

License

Notifications You must be signed in to change notification settings

wesmatlock/APNSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APNSwift

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

Initialization

SecIdentity

let apnsConnection = APNS(identity: certificateIdentity, options: apnsOptions)

PFCS Container (.p12)

guard let apns = APNS(certificatePath: "/path/to/PKCS/certificate", passphrase: "********") else {
    //Failed to create APNS object
    return nil
}

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

Mac App

APNS Push is a Mac app that allows you to send notifications over a HTTP/2 connection. APNS Push app uses the APNSwift library to send push notifications

Now seamlessly send Push Notifications to your iPhone, iPad, Mac and Safari

Features

  • Directly send notifications using Certificates in KeyChain
  • Also supports newly introduced Unified Push certificates
  • Basic mode for quickly testing notifications
  • Advanced mode for more fine grained control over push notifications

About

HTTP/2 Swift APNS library for notification provider

Resources

License

Stars

Watchers

Forks

Packages

No packages published