Azure Notification Hubs SDK for Apple
This release adds the following:
[UIApplication sharedApplication]
usage[UIApplication sharedApplication]
usageIn newer versions of iOS and Xcode, [UIApplication sharedApplication]
usage has been deprecated in favor of other approaches. This adds it back for one use case of registering for push notifications prior to iOS 10.
This release adds the following:
As the Swift language has added async/await to the codebase, there's a new warning flag in Xcode 13 called -Wcompletion-handler
. Since we have all warnings as errors, we need to get around this by using the NS_SWIFT_DISABLE_ASYNC
attribute. Since this attribute and flag are not supported before Xcode 13, we have our own define which wraps this as ANH_SWIFT_DISABLE_ASYNC
until we require Xcode 13 and above to compile the SDK.
This release adds the following:
UNAuthorizationOptions
By default, the SDK will initialize with the UNAuthorizationOptions
for alert, badge and sound, however, if you wish to change that, you can use the startWithConnectionString:hubName:options
method specifying which options you wish to use, to allow for such things as provisional push notifications.
Swift:
let connectionString = "<connection-string>"
let hubName = "<hub-name>"
// Create with alert, badge and sound
let hubOptions = MSNotificationHubOptions(withOptions: [.alert, .badge, .sound])
// Start SDK
MSNotificationHub.start(connectionString: connectionString!, hubName: hubName!, options: hubOptions!)
Objective-C:
NSString *connectionString = @"<connection-string>";
NSString *hubName = @"<hub-name>";
// Create with alert, badge and sound
MSNotificationHubOptions *hubOptions = [[MSNotificationHubOptions alloc] initWithAuthorizationOptions:(UNAuthorizationOptions)(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge)];
// Start SDK
[MSNotificationHub startWithConnectionString:connectionString hubName:hubName options:hubOptions];
This release includes support for Apple Silicon for macOS.
The Azure Notification Hubs SDK for Apple version 3.1.1 has been released with the following:
x-ms-version
header to 2020-06
This release adds the Push to User functionality to the Azure Notification Hubs SDK for Apple.
The SDK supports the ability to associate a user with an installation. This allows you to be able to target all devices associated with a particular User ID. The user's identity set through the SDK can be whatever the developer wants it to be: the user's name, email address, phone number, or some other unique identifier. This is supported through the MSNotificationHub
and the setUserId
method.
Swift:
let userId = "iosUser123"
MSNotificationHub.setUserId(userId);
Objective-C:
NSString *userId = @"iosUser123";
[MSNotificationHub setUserId:userId];
To target a particular user on the backend, you can specify a tag such as $UserId:{VALUE} where VALUE is the user name you have specified, just as you can target an installation using the $InstallationId:{VALUE} tag.
Minor release which includes the following:
Bug Fixes:
This is a minor release with the following fixes:
The Azure Notification Hubs SDK for Apple has finally been released. This introduces a new API through the MSNotificationHub
class, which utilizes the Installation API instead of the legacy Registration API. This new API includes support for iOS, tvOS, macOS and Mac Catalyst. Note, the existing SBNotificationHub
class is considered legacy and not recommended for new application usage.
This is a minor patch release of the Azure Notification Hubs SDK for Apple containing some fixes which solve some bugs from symbol collisions when mixed with AppCenter frameworks.