Skip to content

Commit 237b9c8

Browse files
Update README.md
1 parent 6fc79b7 commit 237b9c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ await apn.SendAsync(notification, deviceToken);
100100
```
101101
**IMPORTANT**: Initialize 1 ApnSender per bundle. When you send many messages at once make sure to retry the sending in case of an error. If error happens it's recommended to retry the call after 1 second delay (await Task.Delay(1000)). Apple typically doesn't like to receive too many messages and will ocasionally respond with HTTP 429. From my experiance it happens once per 1000 requests.
102102

103-
Please see Apple notification format examples here: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1.
104-
Tip: To send properties like {"content-available": true} you can use Newtonsoft.Json attributes over C# properties like `[JsonProperty("content-available")]`.
103+
Please see Apple notification payload examples here: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1.
104+
Tip: To send properties like {"content-available": true} you can use System.Text.Json attributes over C# properties like `[JsonPropertyName("content-available")]`.
105105

106106
## Example of notification payload
107107
You can find expected notification formats for different types of notifications in the documentation. To make it easier to get started, here is a simple example of visible notification (the one that you'll see in phone's notification center) for iOS:
@@ -111,17 +111,17 @@ public class AppleNotification
111111
{
112112
public class ApsPayload
113113
{
114-
[JsonProperty("alert")]
114+
[JsonPropertyName("alert")]
115115
public string AlertBody { get; set; }
116116
}
117117

118118
// Your custom properties as needed
119119
120-
[JsonProperty("aps")]
120+
[JsonPropertyName("aps")]
121121
public ApsPayload Aps { get; set; }
122122
}
123123
```
124-
Use `[JsonProperty("alert-type")]` attribute to serialize C# properties into JSON properties with dashes.
124+
Use `[JsonPropertyName("alert-type")]` attribute to serialize C# properties into JSON properties with dashes.
125125

126126
# MIT License
127127

0 commit comments

Comments
 (0)