THis repo contains two apps , one is for registering push notification and another for sendin push notification to apns server
#APNS-Server - The APN Server app
Follow the below steps to install the app,
-
open the
APNS-Server/APNSPusher
app -
Go to the
target->APNSPusher
and set teh bundleID (Bundle Id should be added to the grouping in apple developer account) -
set signing credentials
-
Enable the
App Groups
in Capabilities. Please select the group name where your Bundle ID is added. -
Go to the
target-> Shareme
. -
set Bundle Identifier annd signing credentials (the bundleId should be inside the same group as the
APNSPusher
bundle Id). -
In the capabilities enable the
App Groups
, and select the app group. -
open keychain and export your
push development iOS certificate
as p12. -
drag and drop the p12 file to the
APNSPusher/Cert
folder inside Xcode -
open the
APNSPusher/Utils
and go toConstants.swift
file. give values for -APP_BUNDLE_GROUP_NAME
,PUSH_BUNDLE_ID
,PUSH_CERT_NAME
andPUSH_CERT_PASSWORD
.
Note: The
PUSH_BUNDLE_ID
field is teh bundle id of the second app (APNS-Client) that register for push notification.
-
Go to
ShareMe/ShareViewController.swift
and add your group Id value insidelet userdefaults = UserDefaults.init(suiteName: "your group ID")
-
Build the app and run
Now we will go and setup the second app..
#APNS-Client - The client app
To run the client app do the following,
-
Open the
APNS-Client/pushAlert
app and add Bundle Id (same value you gave inPUSH_BUNDLE_ID
inPNS-Server
app ) -
add signing credentials
-
Add
push notification
,Background->Remote notification
andbackground fetch
capabilities -
Run your app and register for push notification.
-
it will ask you for sharing the token, select the
APNSPusher
from the list. -
Now open the
APNSPusher
app. It will show you the shared token frompushAlert
app. -
type the message and perform send action.
-
open the
APNSPusher
app the see the messages that came. the messages will be stored when th eapp is in teh background , and when you open the next time it will show you the recieved push message.
Copyright 2017 Ananth.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.