azure-notificationhubs-xamarin
azure-notificationhubs-xamarin copied to clipboard
[BUG] APNS Template Ignored when Added
Describe the bug Cannot attach template to MSNotificationHub.
Exception or Stack Trace
0 CoreFoundation 0x00000001a97a8814 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 1230868 1 ProjectName.iOS 0x0000000108073938 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 61493108 2 ProjectName.iOS 0x0000000108073b78 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 61493684 3 ProjectName.iOS 0x00000001080824c0 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 61553404 4 Foundation 0x00000001aaac9d40 __NSFireTimer + 64 5 CoreFoundation 0x00000001a97170f0 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 635120 6 CoreFoundation 0x00000001a9716cf0 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 634096 7 CoreFoundation 0x00000001a97161c4 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 631236 8 CoreFoundation 0x00000001a97104fc 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 607484 9 CoreFoundation 0x00000001a970f818 CFRunLoopRunSpecific + 572 10 GraphicsServices 0x00000001bfe15570 GSEventRunModal + 160 11 UIKitCore 0x00000001ac03b0e8 186F3A78-108A-3057-A67E-800A88EBFF00 + 11731176 12 UIKitCore 0x00000001ac040664 UIApplicationMain + 164 13 ProjectName.iOS 0x00000001054e3ed8 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 15815956 14 ProjectName.iOS 0x0000000105420530 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 15014764 15 ProjectName.iOS 0x00000001054204b4 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 15014640 16 ProjectName.iOS 0x0000000104615840 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 290428 17 ProjectName.iOS 0x00000001049c4df0 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 4154412 18 ProjectName.iOS 0x00000001080fc618 mono_pmip + 28048 19 ProjectName.iOS 0x00000001081b612c mono_pmip + 788644 20 ProjectName.iOS 0x00000001081bc3e0 mono_pmip + 813912 21 ProjectName.iOS 0x00000001080dab70 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 61915564 22 ProjectName.iOS 0x00000001082c1b40 xamarin_log + 24484 23 ProjectName.iOS 0x0000000104615688 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 289988 24 libdyld.dylib 0x00000001a93ee140 5FFFB964-39D6-3CCF-BD34-C6CA4A148D1A + 4416 )
To Reproduce
Add a template to MSNotificationHub
Code Snippet
// Set the delegate for receiving messages
MSNotificationHub.SetDelegate(new NotificationDelegate());
// Start the API
MSNotificationHub.Start(Constants.ListenConnectionString, Constants.NotificationHubName
public static string APNTemplateBody = @"{
""aps"": {
""content-available"":1,
""messageParam"" : ""$(messageParam)""
}
}";
var body = Constants.APNTemplateBody;
var template = new MSInstallationTemplate();
template.Body = body;
MSNotificationHub.SetTemplate(template, key: "template1");
Expected behavior
When i send a notification matching the template, it is received by the app.
Screenshots If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
- OS: [e.g. iOS 14.6]
- IDE : [e.g. Visual Studio 2019 for Mac]
- 3.11
Note: When I remove the MSNotificationHub.SetTemplate(template, key: "template1"); the crash does not occur.