You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tutorial shows you how to use Azure Notification Hubs to send push notifications to an iOS application. You create a blank Xamarin.iOS app that receives push notifications by using the [Apple Push Notification Service (APNs)](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html).
26
+
27
+
This tutorial shows you how to use Azure Notification Hubs to send push notifications to an iOS application. You create a blank Xamarin.iOS app that receives push notifications by using the [Apple Push Notification Service (APNS)](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html).
27
28
28
29
When you're finished, you are able to use your notification hub to broadcast push notifications to all the devices running your app. The finished code is available in the [NotificationHubs app][GitHub] sample.
29
30
30
-
In this tutorial, you create/update code to do the following tasks:
31
+
In this tutorial, you create/update code to do the following tasks:
31
32
32
33
> [!div class="checklist"]
33
34
> * Generate the certificate signing request file
34
35
> * Register your app for push notifications
35
36
> * Create a provisioning profile for the app
36
37
> * Configure your notification hub for iOS push notifications
37
-
> * Send test push notificaitons
38
+
> * Send test push notifications
38
39
39
40
## Prerequisites
40
41
41
42
-**Azure subscription**. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
@@ -52,14 +53,16 @@ Completing this tutorial is a prerequisite for all other Notification Hubs tutor
52
53
[!INCLUDE [Notification Hubs Enable Apple Push Notifications](../../includes/notification-hubs-enable-apple-push-notifications.md)]
53
54
54
55
## Configure your notification hub for iOS push notifications
56
+
55
57
This section walks you through the steps to create a new notification hub and configure authentication with APNS using the **.p12** push certificate that you previously created. If you want to use a notification hub that you have already created, you can skip to step 5.
### Configure iOS settings for the notification hub
60
-
1. Select **Apple (APNS)** in the **NOTIFICATION SETTINGS** group.
61
-
2. Select **Certificate**, click the **file** icon, and select the **.p12** file that you exported earlier.
62
-
3. Specify the **password** for the certificate.
62
+
63
+
1. Select **Apple (APNS)** in the **NOTIFICATION SETTINGS** group.
64
+
2. Select **Certificate**, click the **file** icon, and select the **.p12** file that you exported earlier.
65
+
3. Specify the **password** for the certificate.
63
66
4. Select **Sandbox** mode. Use the **Production** mode only if you want to send push notifications to users who purchased your app from the store.
64
67
65
68
![Configure APNS in Azure portal][6]
@@ -69,9 +72,11 @@ This section walks you through the steps to create a new notification hub and co
69
72
Your notification hub is now configured to work with APNS, and you have the connection strings to register your app and send push notifications.
70
73
71
74
## Connect your app to the notification hub
72
-
#### Create a new project
75
+
76
+
### Create a new project
77
+
73
78
1. In Visual Studio, create a new iOS project and select the **Single View App** template, and click **Next**
74
-
79
+
75
80
![Visual Studio - Select Application Type][31]
76
81
77
82
2. Enter your App Name and Organization identifier, then hit **Next**, then **Create**
@@ -80,145 +85,147 @@ Your notification hub is now configured to work with APNS, and you have the conn
80
85
81
86
![Visual Studio- iOS App Config][32]
82
87
83
-
4. From the Solution view, double-click *Entitlements.plist* and ensure that "Enable Push Notifications" is checked.
88
+
4. From the Solution view, double-click *Entitlements.plist* and ensure that **Enable Push Notifications**"** is checked.
84
89
85
90
![Visual Studio- iOS Entitlements Config][33]
86
91
87
92
5. Add the Azure Messaging package. In the Solution view, right-click the project and select **Add** > **Add NuGet Packages**. Search for **Xamarin.Azure.NotificationHubs.iOS** and add the package to your project.
88
93
89
94
6. Add a new file to your class, name it **Constants.cs** and add the following variables and replace the string literal placeholders with your *hub name* and the *DefaultListenSharedAccessSignature* noted earlier.
90
-
95
+
91
96
```csharp
92
-
// Azure app-specific connection string and hub path
0 commit comments