All Projects → alexeyxo → Swift Apns

alexeyxo / Swift Apns

Licence: apache-2.0
Swift Framework for sending Apple Push Notification over HTTP/2 API

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Swift Apns

Socket.io Push
整合了小米,华为,友盟,谷歌,苹果推送的统一解决方案
Stars: ✭ 605 (+311.56%)
Mutual labels:  push-notifications, push, apns
Notificationpusher
Standalone PHP library for easy devices notifications push.
Stars: ✭ 1,143 (+677.55%)
Mutual labels:  push-notifications, push, apns
mobile-messaging-sdk-ios
Mobile Messaging SDK for iOS
Stars: ✭ 45 (-69.39%)
Mutual labels:  push-notifications, apns, push
ejabberd mod apns
An ejabberd module to send PUSH messages to iOS devices through APNS
Stars: ✭ 31 (-78.91%)
Mutual labels:  push-notifications, apns, push
Gaurun
General push notification server in Go
Stars: ✭ 804 (+446.94%)
Mutual labels:  push-notifications, apns
Pu.sh
A bash script to send iOS push notifications with the Apple Push Notification service (APNs)
Stars: ✭ 125 (-14.97%)
Mutual labels:  push-notifications, apns
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (+659.18%)
Mutual labels:  push-notifications, push
Push.js
The world's most versatile desktop notifications framework 🌎
Stars: ✭ 8,536 (+5706.8%)
Mutual labels:  push-notifications, push
Uniqush Push
Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.
Stars: ✭ 1,238 (+742.18%)
Mutual labels:  push-notifications, apns
React Native Onesignal
React Native Library for OneSignal Push Notifications Service
Stars: ✭ 1,270 (+763.95%)
Mutual labels:  push-notifications, push
Onepush
消息推送用OnePush,就够了!
Stars: ✭ 1,401 (+853.06%)
Mutual labels:  push-notifications, push
Pushy
A Java library for sending APNs (iOS/macOS/Safari) push notifications
Stars: ✭ 1,353 (+820.41%)
Mutual labels:  push-notifications, apns
Light Push
轻量级推送服务和实时在线监控平台,同时用于开发即时通信系统,基于node的socket.io,支持web、android、ios客户端,支持移动端离线推送,可进行分布式部署
Stars: ✭ 128 (-12.93%)
Mutual labels:  push, apns
Node Pushnotifications
Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
Stars: ✭ 432 (+193.88%)
Mutual labels:  push-notifications, apns
Easynotifylibproject
Send firebase notifications to your users very easily: A new Android Lib
Stars: ✭ 31 (-78.91%)
Mutual labels:  push-notifications, push
Aerogear Unifiedpush Server
🚀 AeroGear UnifiedPush Server
Stars: ✭ 432 (+193.88%)
Mutual labels:  push-notifications, apns
Pushnotification
PHP and Laravel Package to send push notifications to Android and IOS devices.
Stars: ✭ 395 (+168.71%)
Mutual labels:  push-notifications, apns
Vue Push Notification Example
An example repo for using browser push notifications with Vue.js and Firebase
Stars: ✭ 120 (-18.37%)
Mutual labels:  push-notifications, push
Pushok
PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
Stars: ✭ 260 (+76.87%)
Mutual labels:  push-notifications, apns
Onesignal Ios Sdk
OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Stars: ✭ 370 (+151.7%)
Mutual labels:  push-notifications, apns

Logo

Simple framework for sending Apple Push Notifications.

Carthage compatible

Version

Platform

Table of Contents

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate swift-apns into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'APNS', '~> 1.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew install carthage

To integrate swift-apns into your Xcode project using Carthage, specify it in your Cartfile:

github "alexeyxo/swift-apns"

Run carthage update to build the framework and drag the built .framework file into your Xcode project.

Usage

Simple Example

let aps = ["sound":"default", "alert":"testPush()"]
let payload = ["aps":aps]
_ = try! APNSNetwork().sendPush(topic: "com.asdasd.asdasdas", priority: 10, payload: payload, deviceToken: "3dd55a59056441ab275b8b679458388cae76be3a9a02a00234388e50fe91f2fe", certificatePath: Bundle(for:UnitTest.self).pathForResource("push", ofType: "p12")!, passphrase: "123456", sandbox: true, responseBlock: { (response) in
        XCTAssertTrue(response.serviceStatus.0 == 200)
        self.expectation.fulfill()
    }, networkError: { (error) in
        
})
        
        let aps = ["sound":"default", "alert":"testPush()"]
        let payload = ["aps":aps]
        let str = Bundle(for:UnitTest.self).pathForResource("cert", ofType: "p12")!
        var mess = ApplePushMessage(topic: "com.tests.asdasdasd",
                             priority: 10,
                             payload: payload,
                             deviceToken: "3dd55a59056441ab275b8b679458388cae76be3a9a02a00234388e50fe91f2fe",
                             certificatePath:str,
                             passphrase: "123456",
                             sandbox: true,
                             responseBlock:nil,
                             networkError:nil, session: nil)
        
        mess.responseBlock = { response in
        }
        
        mess.networkError = { err in
            if (err != nil) {

            }
        }
        _ = try! mess.send() // OR try! mess.send(session:<URLSession>) 
        

Using with "Protocol Buffers"

Required Protocol Buffers 3.0 and protobuf-swift.

Simple Example

let providerData = Apple.Apns.ProviderData.Builder()
providerData.bundle = "com.aasdad.asdasdsdfa"
providerData.serviceIdentity = Apple.Apns.ProviderData.Identity.Development
providerData.priority = 10
providerData.certificatePath = NSBundle(forClass:UnitTest.self).pathForResource("push", ofType: "p12")!
providerData.certificatePassphrase = "123456"
providerData.token = "3dd55a59056441ab275b8b679458388cae76be3a9a02a00234388e50fe91f2fe"

let aps = Apple.Apns.Push.Aps.Builder()
aps.badge = 1
aps.contentAvailable = 1
aps.sound = "default"
aps.alert = "testSendProtobuf()"
do {
    let payload = try Apple.Apns.Push.Builder().setAps(aps.build()).build()
    providerData.payload = payload
    try APNSNetwork().sendPush(providerData.build(), responseBlock: { (response) -> () in
        print(response)
    })
} catch {

}

Sending Custom Objects

  1. Edit ./Source/ProtoSource/PushService.proto:
...
message Push {
    message Aps {
        string alert = 1;
        string sound = 2;
        int32 badge = 3;
        int32 content_available = 4;
        string category = 5;
    }

    message ExampleCustomObject {
        string objectId = 1;
    }

  Aps aps = 1;
    ExampleCustomObject customObject = 2;
}
  1. Compile new object:
protoc PushService.proto --swift_out="../"

Credits

  • The bird used in the logo - as well as the cloud - are borrowed respectively from the original Swift and APNs logos which have *All Rights Reserved to Apple Inc.

  • The font used in logo comes from the San Francisco family.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].