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/APNSPusherapp -
Go to the
target->APNSPusherand set teh bundleID (Bundle Id should be added to the grouping in apple developer account) -
set signing credentials
-
Enable the
App Groupsin 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
APNSPusherbundle Id). -
In the capabilities enable the
App Groups, and select the app group. -
open keychain and export your
push development iOS certificateas p12. -
drag and drop the p12 file to the
APNSPusher/Certfolder inside Xcode -
open the
APNSPusher/Utilsand go toConstants.swiftfile. give values for -APP_BUNDLE_GROUP_NAME,PUSH_BUNDLE_ID,PUSH_CERT_NAMEandPUSH_CERT_PASSWORD.
Note: The
PUSH_BUNDLE_IDfield is teh bundle id of the second app (APNS-Client) that register for push notification.
-
Go to
ShareMe/ShareViewController.swiftand 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/pushAlertapp and add Bundle Id (same value you gave inPUSH_BUNDLE_IDinPNS-Serverapp ) -
add signing credentials
-
Add
push notification,Background->Remote notificationandbackground fetchcapabilities -
Run your app and register for push notification.
-
it will ask you for sharing the token, select the
APNSPusherfrom the list. -
Now open the
APNSPusherapp. It will show you the shared token frompushAlertapp. -
type the message and perform send action.
-
open the
APNSPusherapp 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.