Passing a dictionary in an API call

Does anyone know what it means to pass a dictionary in an API call? I’m not familiar with that terminology. I’m using onesignal to send a critical alert and it says, " Critical Alerts requires the “sound” parameter to be passed as a dictionary to the API calls"

Any help pointing me in the direction on how to solve this would be much appreciated. Thanks! Jordan

With the following code (this can be copied from .m or .swift):

  • (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.receivedRequest = request;
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];

    // DEBUGGING: Uncomment the 2 lines below and comment out the one above to ensure this extension is excuting
    // Note, this extension only runs when mutable-content is set
    // Setting an attachment or action buttons automatically adds this
    // NSLog(@“Running NotificationServiceExtension”);
    // self.bestAttemptContent.body = [@"[Modified] " stringByAppendingString:self.bestAttemptContent.body];
    if ([request.content.userInfo[@“CRITICAL”] isEqualToString: @“YES”]) {
    [self.bestAttemptContent setSound:[UNNotificationSound
    criticalSoundNamed:@“Alarm.wav” withAudioVolume:1.0]];
    }
    self.contentHandler(self.bestAttemptContent);
    }

Here’s the documentation: iOS: Focus Modes and Interruption Levels
I’m on step 3 of this page.

This topic was automatically closed after 70 days. New replies are no longer allowed.