Skip to content

Commit cd3bd88

Browse files
author
Wonday
committed
fix ios push message error
1 parent 27e689d commit cd3bd88

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ios/RCTAliyunPush/AliyunPushManager.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,10 +619,19 @@ - (void)onMessageReceived:(NSNotification *)notification
619619
{
620620
DLog(@"onMessageReceived.");
621621

622-
NSMutableDictionary *notificationDict = [notification object];
622+
NSMutableDictionary *notificationDict = [NSMutableDictionary dictionary];
623623

624+
CCPSysMessage *message = [notification object];
625+
626+
notificationDict[@"title"] = [[NSString alloc] initWithData:message.title encoding:NSUTF8StringEncoding];
627+
notificationDict[@"body"] = [[NSString alloc] initWithData:message.body encoding:NSUTF8StringEncoding];
624628
// 取得通知自定义字段内容
625-
notificationDict[@"extras"] = [notification userInfo];
629+
if (notification.userInfo) {
630+
notificationDict[@"extras"] = notification.userInfo;
631+
} else {
632+
notificationDict[@"extras"] = @{};
633+
}
634+
626635

627636
// 类型 “notification” or "message"
628637
notificationDict[@"type"] = ALIYUN_PUSH_TYPE_MESSAGE;

0 commit comments

Comments
 (0)