In some of my remote push notification double values are sent in addition to strings. These values I need to format on the receiving device depending on the user's region settings and set the currency properly. I got an idea of/a workaround how to do so while the app is in the foreground:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
...
var locArgsFormatted: [NSObject] = []
for arg in locArgs {
if let double = arg as? Double {
locArgsFormatted.append(Utils.Formatter.currencyOutput.stringFromNumber(double)!)
} else {
locArgsFormatted.append(arg)
}
}
let formattedString = NSString(format: localizedString, arguments: Utils.Methods.getVaListFromArguments(locArgsFormatted)) as! String
}
But I have no idea how to so (and similar adjustments) while the app is in the background. The messages shown in an alert or a banner are automatically created by getting the localized strings in the Localizable.strings file (no option to format any double values first) but how can I intervene like in the example shown before the notification message is shown to the user?