swift - 如何在通知中显示阿拉伯语文本?
问题描述
我收到英语/阿拉伯语两种语言的 FCM 推送通知,但我只想用阿拉伯语显示,如何显示?
我的代码-
@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {
// Receive displayed notifications for iOS 10 devices.
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
if let jsonResult = userInfo as? Dictionary<String, AnyObject> {
if let notifyType = jsonResult["type"] as? String {
if notifyType == "8" || notifyType == "18" {
self.pushRedirection(userInfo: userInfo)
}else{
if let league_id = jsonResult["league_id"] as? String {
if let contestUnique_id = jsonResult["contest_unique_id"] as? String {
}
}
}
}
}
completionHandler([.alert,.sound])
}
我收到了英文通知(比赛提醒)。如何用阿拉伯语设置
我的通知数据是 -
[AnyHashable("gcm.notification.type"): 5, AnyHashable("league_id"): 3, AnyHashable("en_msg"): Match Reminder, AnyHashable("gcm.notification.ar_msg"): القوانين, AnyHashable("gcm.notification.en_msg"): Match Reminder, AnyHashable("gcm.notification.league_id"): 3, AnyHashable("contest_unique_id"): KBm8oVuTR, AnyHashable("gcm.message_id"): 0:1528974245362555%6c5fd9d06c5fd9d0, AnyHashable("gcm.notification.contest_unique_id"): KBm8oVuTR, AnyHashable("ar_msg"): القوانين, AnyHashable("google.c.a.e"): 1, AnyHashable("type"): 5, AnyHashable("aps"): {
alert = "Match Reminder";
}, AnyHashable("body"): Match Reminder]
解决方案
推荐阅读
- xcode - Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?
- dataset - 使用 CDO 仅提取特定区域的数据集
- azure - 在 Azure 机器学习服务笔记本 VM 之间共享笔记本
- video - Direct3d Color space conversion in GPU
- python - 如果字符串不包含值,则使用 Pandas 为字符串列中的每个值添加字符串后缀
- mongodb - Efficient Retrieve of MongoDB items in a time range
- javascript - 如何通过单击 mat-expansion-panel-header 来防止切换 mat-expansion-panel?
- c++ - 如何调试 MIT-DLEP 源?
- java - ForeignCollection throws SQLException on iterating using streams
- python - str.contains in pandas with if statement, python