Xcode 在模拟器中测试富通知
我能够在模拟器中测试正常的通知,但当我尝试测试富通知时,什么都没有发生,事件标题没有得到更新 你能帮助我,如何进行吗。我需要更改任何模拟器设置吗? 我使用的是Xcode 11.4 样本有效载荷:Xcode 在模拟器中测试富通知,xcode,apple-push-notifications,ios-simulator,xcode11.4,unnotificationserviceextension,Xcode,Apple Push Notifications,Ios Simulator,Xcode11.4,Unnotificationserviceextension,我能够在模拟器中测试正常的通知,但当我尝试测试富通知时,什么都没有发生,事件标题没有得到更新 你能帮助我,如何进行吗。我需要更改任何模拟器设置吗? 我使用的是Xcode 11.4 样本有效载荷: { "aps": { "mutable-content": 1, "alert": { "body": "Push notification body
{
"aps": {
"mutable-content": 1,
"alert": {
"body": "Push notification body",
"title": "Push notification title"
}
},
"media-url": "https://i.imgur.com/t4WGJQx.jpg"
}
NotificationService扩展方法:
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",
self.bestAttemptContent.title];
}
看着
在已知问题下:
通知服务扩展无法在模拟推送中工作
通知。不接受可变内容密钥。(55822721)
我想你的退路是通过使用工具发送真正的通知来测试它,如where you need:
- 设备令牌
- 包标识符
- 证书或代币
- 有效载荷
- 选择正确的环境
我自己使用了PushNotifications,它很管用。仅供参考,这在12.5 Beta版中仍然没有固定。