-->
Important
Note this feature is being retired. For more information, see the blog post. For more information, refer to the Push Migration Guide.
App Center Push enables you to send push notifications to users of your app from the App Center portal.
Prerequisite - Enable Apple Push Notifications service (APNs) for your app
Icarus may be installed from source code or from pre-packaged binary distributions. 1 Installation From Source 1.1 Obtaining Snapshots 1.2 Obtaining Source From git 1.3 Icarus Specific Configuration Options 1.4 Compiling on Linux/Unix 1.5 Compiling on Macintosh OS X 1.6 Compiling on Solaris 1.7 Compiling on MS Windows (MinGW) 1.8 Compiling on MS Windows (Cygwin) 2 Installation From Premade. Git remote git fetch git push git pull The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
Configure Apple Push Notifications service (APNs) for your app from your Apple developer account and App Center portal before adding App Center Push to your app.
Enable push notifications on your application
In Xcode's project editor, choose your target and click Capabilities. In the Push Notifications section, click the switch to turn it from OFF to ON.
Set up APNs
Log in to the App Center portal, select your application, click on the Push button from the left menu then click Next to reveal the push notification settings UI:
On the bottom of the page, select Sandbox for initial development or Production for production version of your application.
Collect the following information:
Prefix and ID
Go to your Apple developer account and select your application from the App ID list in Identifiers.
Copy the Prefix value from this window and paste it to the App Center push settings.
Do the same with the ID value.
Key ID
In your Apple developer account create a new key in Certificates, Identifiers & Profiles/Keys.
Make sure to check the APNs checkbox.
Fill in the key name
Press Continue then Confirm.
On the next screen, copy the Key ID value and paste it to the App Center push settings.
Download the key file.
Push Token
- On the App Center push settings page, upload your key file using the button labelled 'Auth key file:' (you can also drag and drop the file onto it):
- Click Done to complete this configuration.
For more information, refer to the Apple documentation.
Add App Center Push to your app
1. Add the App Center Push module
The App Center SDK is designed with a modular approach – you only need to integrate the services that you're interested in.
Integration via Cocoapods
If you're integrating App Center into your app via Cocoapods, add the following dependency to your podfile and run pod install
.
Integration via Carthage
Add the following dependency to your
Cartfile
to include App Center.Run
carthage update
.Open your application target's General settings tab. Drag and drop the AppCenterPush.framework file from the Carthage/Build/iOS folder to the Linked Frameworks and Libraries section in XCode.
A dialog will appear, make sure your app target is checked. Then click Finish.
Integration by copying the binaries into your project
If you don't want to use Cocoapods, you can integrate the modules by copying the binaries into your project. Follow the steps below:
Download the App Center SDK frameworks provided as a zip file.
Unzip the file and you'll see a folder called AppCenter-SDK-Apple that contains different frameworks for each App Center service on each platform folder. The framework called
AppCenter
is required in the project as it contains code that's shared between the different modules.[Optional] Create a subdirectory for 3rd-party-libraries.
- As a best practice, 3rd-party libraries usually reside inside a subdirectory (it is often called Vendor), so if you don't have your project organized with a subdirectory for libraries, create a Vendor subdirectory now.
- Create a group called Vendor inside your Xcode project to mimic your file structure on disk.
Open the unziped AppCenter-SDK-Apple folder in Finder and copy the folder into your project's folder at the location where you want it to reside. The folder contains frameworks in subfolders for other platforms that App Center SDK supports, so you might need to delete subfolders that you don't need.
Add the SDK framework to the project in Xcode:
- Make sure the Project Navigator is visible (⌘+1).
- Now drag and drop AppCenter.framework and AppCenterPush.framework from the Finder (the ones inside the Vendor folder) into Xcode's Project Navigator. AppCenter.framework is required to start the SDK, make sure it's added to your project, otherwise the other module won't work and your project won't compile successfully.
- A dialog will appear, make sure your app target is checked. Then click Finish.
2. Start App Center Push
To use App Center, opt in to the module(s) that you want to use. By default no modules are started and you must explicitly call each of them when starting the SDK.
2.1 Add the import for App Center Push
Boltronic mac os. Open the project's AppDelegate.m file in Objective-C or AppDelegate.swift file in Swift and add the following import statements:
2.2 Add the start:withServices:
method
Add MSPush
to your start:withServices:
method to start App Center Push together with the other services that you want to use in your app.
Insert the following line to start the SDK in the project's AppDelegate.m class in Objective-C or AppDelegate.swift class in Swift in the applicationDidFinishLaunching
method.
Make sure you've replaced {Your App Secret}
in the code sample above with your App Secret. Also check out the Get started section if you haven't configured the SDK in your application.
2.3 Add internet capabilities for sandboxed apps
If your app is using the App Sandbox, set the capability to allow incoming (Server) and outgoing (Client) connections to allow the app to have access to the internet.Xcode 9 enables the App Sandbox by default but the capabilities for incoming and outgoing connections need to be set explicitly.
Select your project in the project navigator, select the Capabilities tab and if your app is using the sandbox, enable incoming and outgoing connections.
Intercept push notifications
You can set up a delegate to be notified whenever a push notification is received while the application is active (currently frontmost) or a notification in Notification Center has been clicked by the user.
Push Pull Osmotic Pump
By default, App Center Push doesn't generate notifications when the push is received while the application is active, you can use the delegate to customize the push experience when received while the application is active or do a specific action when the application is being active by clicking on the notification from Notification Center when received while the application is inactive. *App Center Push won't generate any notifications if the push is received while the application isn't running.
Push Pull Mosfet Circuits
You need to register the delegate before starting App Center as shown in the following example:
Here is an example of the delegate implementation that displays an alert dialog when the message is received by App Center Push:
Enable or disable App Center Push at runtime
You can enable and disable App Center Push at runtime. If you disable it, the SDK will stop updating the device token used to push but the existing one will continue working. In other words, disabling the App Center Push in the SDK will NOT stop your application from receiving push notifications.
To enable App Center Push again, use the same API but pass YES
/true
as a parameter.
The state is persisted in the device's storage across application launches.
Note
This method must only be used after MSPush
has been started.
Check if App Center Push is enabled
You can also check if App Center Push is enabled or not:
Note
Push/pull Mac Os X
This method must only be used after MSPush
has been started, it will always return NO
or false
before start.
Disable automatic forwarding of application delegate's methods to App Center services
App Center uses swizzling to automatically forward your application delegate's methods to App Center services to improve SDK integration. There's a possibility of conflicts with other third-party libraries or the application delegate itself. In this case, you might want to disable the App Center application delegate forwarding for all App Center services by following the steps below:
Push/pull Mac Os Update
Open the project's Info.plist file.
Add
AppCenterAppDelegateForwarderEnabled
key and set the value to0
. This disables application delegate forwarding for all App Center services.Implement the callbacks to register push notifications
Implement the
application:didRegisterForRemoteNotificationsWithDeviceToken:
callback and theapplication:didFailToRegisterForRemoteNotificationsWithError:
callback in your AppDelegate to register for Push notifications.Implement the callback to receive push notifications
Implement the
application:didReceiveRemoteNotification:
callback to forward push notifications to App Center Push.