Swiftpack.co - Package - urbanairship/ios-library

Airship iOS SDK

The Airship SDK for iOS provides a simple way to integrate Airship services into your iOS applications.

Resources

Installation

Xcode 11.0+ is required for all projects and the static library. Projects must target >= iOS 11.

CocoaPods

Make sure you have the CocoaPods dependency manager installed. You can do so by executing the following command:

$ gem install cocoapods

The primary Airship pod includes the standard feature set and is advisable to use for most use cases. The standard feature set includes Push, Actions, In-App Automation, and Message Center

Example podfile:

use_frameworks!

# Airship SDK
target "<Your Target Name>" do
  pod 'Airship'

  # Optional: uncomment to install the location subspec
  # pod 'Airship/Location'
end

The Airship pod also contains several subspecs that can be installed independently and in combination with one another when only a particular selection of functionality is desired:

  • Airship/Core : Push messaging features including channels, tags, named user and default actions
  • Airship/MessageCenter : Message center
  • Airship/Automation : Automation and in-app messaging
  • Airship/Location : Location including geofencing and beacons
  • Airship/ExtendedActions : Extended actions

Example podfile:

use_frameworks!

target "<Your Target Name>" do
  pod 'Airship/Core'
  pod 'Airship/MessageCenter'
  pod 'Airship/Automation'

  # Optional: uncomment to install the location subspec
  # pod 'Airship/Location'
end
{{< /highlight >}}
Specify Airship, and optionally, Airship/Location pods in your `podfile`
with the use_frameworks! option:

Install using the following command:

$ pod install

In order to take advantage of notification attachments, you will need to create a notification service extension alongside your main application. Most of the work is already done for you, but since this involves creating a new target there are a few additional steps. First create a new "Notification Service Extension" target. Then add AirshipExtensions/NotificationService to the new target:

use_frameworks!

# Airship SDK
target "<Your Service Extension Target Name>" do
  pod 'AirshipExtensions/NotificationService'
end

Install using the following command:

$ pod install

Then delete all the dummy source code for the new extension and have it inherit from UANotificationServiceExtension:

import AirshipExtensions

class NotificationService: UANotificationServiceExtension {

}

Carthage

Make sure you have Carthage installed. Carthage can be installed using Homebrew with the following commands:

$ brew update
$ brew install carthage

Specify the Airship iOS SDK in your cartfile:

github "urbanairship/ios-library"

Execute the following command in the same directory as the cartfile:

$ carthage update

In order to take advantage of notification attachments, you will need to create a notification service extension alongside your main application. Most of the work is already done for you, but since this involves creating a new target there are a few additional steps:

  • Create a new iOS target in Xcode and select the "Notification Service Extension" type
  • Drag the new AirshipNotificationServiceExtension.framework into your app project
  • Link against AirshipNotificationServiceExtension.framework in your extension's Build Phases
  • Add a Copy Files phase for AirshipExtensions.framework and select "Frameworks" as the destination
  • Delete all dummy source code for your new extension
  • Inherit from UANotificationServiceEntension in NotificationService

Other Installation Methods

For other installation methods, see the - Getting started guide.

Quickstart

An Important Note about Location

In Spring 2019, Apple began rejecting applications that use, or appear to use, Core Location services without supplying usage descriptions in their Info.plist files. In Airship SDK 11, all references to CoreLocation have been removed from the core library and placed in a separate location framework. Developers with no need for location services can continue to use Airship as before, but for those who have been using the UALocation class, see the Location sections for updated setup instructions.

Warning

As of SDK 10.2 and Apple's current App Store review policies, apps building against Airship without location usage descriptions in Info.plist are likely to be rejected. The easiest way to avoid this, if location services are not needed, is to use Airship SDK 11 or greater. If building against previous Airship SDKs, you will need to add add usage description strings to your Info.plist file under the NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, and NSLocationAlwaysAndWhenInUseUsageDescription keys.

Capabilities

Enable Push Notifications and Remote Notifications Background mode under the capabilities section for the main application target.

Adding an Airship Config File

The library uses a .plist configuration file named AirshipConfig.plist to manage your production and development application profiles. Example copies of this file are available in all of the sample projects. Place this file in your project and set the following values to the ones in your application at http://go.urbanairship.com. To view all the possible keys and values, see the UAConfig class reference

You can also edit the file as plain-text:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>detectProvisioningMode</key>
      <true/>
      <key>developmentAppKey</key>
      <string>Your Development App Key</string>
      <key>developmentAppSecret</key>
      <string>Your Development App Secret</string>
      <key>productionAppKey</key>
      <string>Your Production App Key</string>
      <key>productionAppSecret</key>
      <string>Your Production App Secret</string>
    </dict>
    </plist>

The library will auto-detect the production mode when setting detectProvisioningMode to true.

Advanced users may add scripting or preprocessing logic to this .plist file to automate the switch from development to production keys based on the build type.

Call Takeoff

To enable push notifications, you will need to make several additions to your application delegate.

    - (BOOL)application:(UIApplication *)application
            didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        // Your other application code.....

        // Set log level for debugging config loading (optional)
        // It will be set to the value in the loaded config upon takeOff
        [UAirship setLogLevel:UALogLevelTrace];

        // Populate AirshipConfig.plist with your app's info from https://go.urbanairship.com
        // or set runtime properties here.
        UAConfig *config = [UAConfig defaultConfig];

        // You can then programmatically override the plist values:
        // config.developmentAppKey = @"YourKey";
        // etc.

        // Call takeOff (which creates the UAirship singleton)
        [UAirship takeOff:config];

        // Print out the application configuration for debugging (optional)
        UA_LDEBUG(@"Config:\n%@", [config description]);

        // Set the icon badge to zero on startup (optional)
        [[UAirship push] resetBadge];

        // User notifications will not be enabled until userPushNotificationsEnabled is
        // set YES on UAPush. Once enabled, the setting will be persisted and the user
        // will be prompted to allow notifications. You should wait for a more appropriate
        // time to enable push to increase the likelihood that the user will accept
        // notifications.
        // [UAirship push].userPushNotificationsEnabled = YES;

        return YES;
    }

To enable push later on in your application:

    // Somewhere in the app, this will enable push (setting it to NO will disable push,
    // which will trigger the proper registration or de-registration code in the library).
    [UAirship push].userPushNotificationsEnabled = YES;

SDK Development

Make sure you have the CocoaPods dependency manager installed. You can do so by executing the following command:

$ gem install cocoapods

Install the pods:

$ pod install

Open Airship.xcworkspace

$ open Airship.xcworkspace

Update the Samples AirshipConfig by copyingAirshipConfig.plist.sample to AirshipConfig.plist and update the app's credentials. You should now be able to build, run tests, and run the samples.

The distribution can be generated by running the build.sh script:

./scripts/build.sh

Continuous integration will run scripts/run_ci_tasks.sh for every PR submitted.

Github

link
Stars: 443

Dependencies

Used By

Total: 0

Releases

14.1.2 - 2020-09-24 22:59:42

Patch release to fix a crash related to sending In-App Messages through push notifications. Applications running 14.0.0+ that use In-App Messages should update.

14.1.1 - 2020-09-18 22:59:57

Patch release fixing a crash in the Airship and AirshipAutomation XCFramework. Apps using XCFrameworks should update.

Changes

  • Added missing resources to Airship and AirshipAutomation modules
  • Fixed XCFrameworks build issues for AirshipAccengage
  • Fixed sample app build issues when targeting macOS Catalyst

14.1.0 - 2020-09-16 15:46:06

Minor release that adds support for iOS 14 features and Swift package manager.

Changes

  • Requires Xcode 12+
  • Swift package manager support
  • Support for App Clips and ephemeral notification authorization
  • Support for reduced accuracy location
  • Support for list and banner notification types

14.1.0-beta1 - 2020-09-09 19:56:01

Initial 14.1.0 beta with support for new iOS 14 features.

Changes

  • Swift package manager support
  • Support for App Clips and ephemeral notification authorization
  • Support for reduced accuracy location
  • Support for list and banner notification types

14.0.0 - 2020-09-03 23:52:33

Airship SDK 14 is a major update that prepares our automation module to support future IAA enhancements, revamps the Channel Capture tool, and provides other improvements.

The majority of apps will only be effected by the new UAURLAllowList behavior changes.

Changes

  • BEHAVIOR CHANGE All URLs are not verified by default. Applications that use open URL action, landing pages, and custom in-app message image URLs will need to provide a list of URL patterns that match those URLs for SCOPE_OPEN_URL. The easiest way to go back to 13.x behavior is to add the wildcard symbol * to the array under the URLAllowListScopeOpenURL key in your AirshipConfig.plist.
  • Channel Capture tool now detects a knock of 6 app opens in 30 seconds. Instead of displaying anything to the user, the tool will write the current channel ID to the clipboard.
  • UAWhitelist class and terminology removed and replaced with UAURLAllowList.
  • UAActionAutomation class and functionality has been moved to UAInAppAutomation, which covers both Action Automation and In-App Messages.
  • In-App Automation APIs have been updated to support future IAA enhancements.
  • Removed deprecated APIs.

See the Migration Guide for further details.

13.5.6 - 2020-09-03 22:15:50

Patch release to fix quiet time being applied to channels even if quiet time is disabled. This only affects channels that have set a quiet time using setQuietTimeStartHour:startMinute:endHour:endMinute.

13.5.5 - 2020-09-03 00:25:38

Patch release to fix a bug in analytics that could result in events being uploaded with stale session IDs. Apps using reports are encouraged to upgrade.

13.5.4 - 2020-08-12 23:05:26

Patch release to address Dynamic Type build warnings and Message Center Inbox UI issues. Message Center customers who support Dynamic Type are encouraged update to this version.

13.5.3 - 2020-08-07 00:37:05

Patch release to fix a crash with Accengage data migration. Accengage migration customers should update.

13.5.2 - 2020-07-28 22:13:50

Patch release to improve iOS 14 support, add a missing XCFramework, and fix In-App Automation issues. Apps that support in-app automation, or are experiencing any of these issues are encouraged to update.

Changes

  • Disable Channel Capture by default to prevent new iOS 14 notifications.
  • Add missing AirshipAutomation.xcframework to GitHub releases.
  • Handle GIFs in a different way so modal messages have the correct height.
  • Fix IAA version trigger to only fire on app updates instead of new installs.
  • Enable font size accessibility in IAA and Message Center messages.

13.5.1 - 2020-07-10 22:38:17

Patch release for compatibility with Xcode 12, adding new messageCenterStyle properties to the default message center UI classes to avoid conflicting with UIKit changes in iOS 14. The original style properties will continue to be available when compiling with Xcode 11, but are not available in Xcode 12. Apps that wish to remain on 13.x while developing on iOS 14 are encouraged to upgrade.

  • Added new messageCenterStyle properties to the default message center UI

14.0.0-beta1 - 2020-07-09 23:48:27

Early 14.0.0 beta that allows building SDK on Xcode 12.

Changes

  • Fixed build issue on Xcode 12 due to style name collision.

13.5.0 - 2020-07-08 23:10:22

Minor release adding support for application-defined locale overrides, and fixing issues in In-App Automation and the Actions Framework.

  • Added UALocaleManager
  • Fixed issue preventing display of inline videos in HTML In-App Automations
  • Fixed issue causing crashes when running actions enabling location services

13.4.0 - 2020-06-24 00:23:55

Minor release to add support for blank urls in messages, enhance airship-ready broadcasts and fix issues with in-app messages. Apps that support in-app automation, or require any of the support changes listed below are encouraged to update.

  • Fixed issue that caused analytics events to fail to upload after enabling data collection in the same app session.
  • Fixed In-App Message modal resizing and button text alignment.
  • Added support to In-App Automation and Message Center Messages for opening target=_blank urls in an external browser.
  • Added support for broadcasting a system notification containing the channel and app key when the channel is created.

13.3.2 - 2020-05-27 22:23:52

Patch release to fix an issue with in-app automation banner messages and a namespacing issue. Apps that support in-app automation banner messages are encouraged to update.

Changes

  • Fixed an issue with in-app automation banner messages displaying incorrectly at the top of the display.
  • Make versionString const static to address link namespacing error.
  • Fixed "MobileCoreServices" build warning.

13.3.1 - 2020-05-09 01:29:54

Patch release to fix an issue with in-app automation audience condition checking. Apps that use version and locale-based audience conditions for targeting in-app messaging are encouraged to update.

Changes

  • Fixed issue with in-app automation audience condition checking.

13.3.0 - 2020-05-04 21:19:28

Minor release that adds support for named user attributes and fixes issues with YouTube video support and channel registration.

Changes

  • Added support for named user attributes.
  • Fixed YouTube video support in Message Center and HTML In-app messages.
  • Fixed channel registration to occur every APNs registration change.

13.2.1 - 2020-04-24 21:39:33

Patch release to restore public visibility to several header files. Apps whose builds are failing due to one of the following two files not being found should update.

  • UAExtendedActionsResources.h
  • UAMessageCenterMessageViewDelegate.h

13.2.0 - 2020-04-21 00:54:29

Minor release that adds support for enhanced custom events and Mac Catalyst xcframeworks, expands the functionality of the native bridge and fixes bugs related to whitelisting and token registration after disabling data collection.

Changes

  • Added support for enhanced custom events.
  • Added support for Mac Catalyst xcframeworks.
  • Added whitelisting for EU sites.
  • Added message extras getter for Message Center native bridge.
  • Added date attribute support.
  • Fixed push token registration when data collection is disabled.

13.1.1 - 2020-03-21 01:38:11

Patch addressing a regression in 13.1.0 causing channel tag loss when upgrading from SDK versions prior to 13.0.1. Apps not already on 13.0.1 or higher should avoid version 13.1.0.

8.3.0 - 2020-03-02 23:17:48

New Features

  • Added support for WKWebView. Enable in AirshipConfig.plist using useWKWebView flag. Disabled by default.
  • Deprecated support for UIWebView.
  • Added support for delayed automation action schedules. The execution of an automated schedule can now be delayed by up to 30 seconds or made contingent on some condition.
  • Added EnableFeatureAction that can enable background location, location, or user notifications.
  • Added an automation trigger for app init events.
  • Added new UARegistrationDelegate methods apnsRegistrationSucceededWithDeviceToken: and apnsRegistrationFailedWithError:.

Bug Fixes

  • Fixed compatibility issue with Firebase.
  • Fixed duplicate analytic uploads on iOS 8.

Other

  • iOS migration guides moved to this repository.

8.1.1 - 2020-03-02 23:17:47

  • Added conversion methods for UNNotificationAction and UIUserNotificationAction in the public header for UANotificationAction.
  • Fixed set tag group operation issues.

8.1.3 - 2020-03-02 23:17:47

  • Fixed isSilentPush check.
  • Ensure device token registration starts.

8.1.6 - 2020-03-02 23:17:47

  • Fixed an analytics bug for cold start direct opens.

8.1.5 - 2020-03-02 23:17:47

  • Fixed a message selection bug in edit mode for the Message Center.

8.2.1 - 2020-03-02 23:17:47

Bug Fixes

  • Added missing file references to static library.
  • Added extra validation to message list response body.

8.2.2 - 2020-03-02 23:17:47

Bug Fixes

  • Correctly handle local project paths that contain spaces.

8.2.0 - 2020-03-02 23:17:47

New Features

  • Added UATextInputNotificationAction to support text input notification actions.
  • Added accessor to get the app key in the Javascript native bridge.
  • Message center will automatically refresh the message listing in the background when receiving a content-available push.

Bug Fixes

  • Fixed in-app messaging not being cleared from a notification action button.
  • Fixed in-app messaging not being cleared at all if displayASAP is enabled.
  • Fixed inbox database file name to be stored under the app key.
  • Fixed schedule action not being able to parse variations of an ISO 8601 timestamp.
  • Improved Message Center cell text animations when entering "Edit" mode.

Behavior Changes

  • Channel Capture tool is now disabled by default if the app is able to receive background push. A new action has been added to enable the tool for a limited duration.

8.3.2 - 2020-03-02 23:17:47

Bug Fixes

  • Added files missing from static library libUAirship.a
  • Fix compiler warnings

8.4.0 - 2020-03-02 23:17:47

Bug Fixes

  • Fixed "invalid prototype declaration" warnings.
  • Fixed calling UIKit on background threads.
  • Fixed deprecation warnings when targeting iOS 10+.

Features

  • Added support for tvOS.
  • Added loading indicator to Message Center message view controllers.
  • Added new UAInboxDelegate protocol method showMessageForID: that will be called immediately after a notification is tapped that is associated with a Message Center message.
  • Added support to update authorized notification options during a background app refresh.
  • Added support to style the select all, delete, and mark read buttons in the message center.

Deprecations

  • Alias is now deprecated. It will be removed in SDK 10.0.0.
  • UAInboxDelegate's showInboxMessage:, replaced with showMessageForID:.
  • UADefaultMessageCenter's displayMessage: and displayMessage:animated:, replaced with displayMessageForID: and displayMessageForID:animated: methods.
  • UADefaultMessageCenterListViewController's displayMessage: and displayMessage:onError:, replaced with displayMessageForID: and displayMessageForID:onError:.
  • UAInAppMessage's unused property notificationActionContext.