我为我的商店建立了一个网站,并向其中添加了一些优惠券。我添加了一个链接来下载带有优惠券的 pkpass 文件,这样我的客户就可以将优惠券保存到他们的 Apple Wallet 应用程序中。我希望在客户将该卡保存到他们的设备后(例如更改优惠券文本)可以选择远程更新该卡,但我读到的所有内容都表明,只有客户从应用程序保存该卡时,您才能更新该卡而不是来自网络。那是对的吗?如果我的用户设备上没有安装应用程序,是否无法推送优惠券更新?有什么办法解决吗?
我有一个 iOS 应用程序,可以接收来自 APNS 的通知。如果我的用户删除该应用程序,后端将无法知道该应用程序未安装在某个设备(设备令牌)上。在这种情况下,尝试通过 APNS 推送时会生成什么错误代码,以便我可以从数据库中删除该条目?
我在 Stack Overflow 上发现了类似的问题,但没有一个能澄清这一点。
我正在使用 Firebase Cloud Messaging 在我的应用程序中发送推送通知。我将收到的消息存储在本地数据库中。当我的应用程序处于活动状态或在后台时,我的应用程序能够接收通知(正确调用委托方法),但如果应用程序被强制退出或不在内存中,则设备也会接收通知并位于通知中心但是当应用程序通过图标启动时,没有调用任何委托方法。如果用户单击通知中心中的“消息”,则会启动应用程序,但只会接收单击的消息,而不是所有消息(在收到多个通知的情况下)。据苹果公司称,如果用户强制退出,系统不会自动启动您的应用程序。在这种情况下,用户必须重新启动您的应用程序或重新启动设备,然后系统才会尝试再次自动启动您的应用程序。
但即使用户启动应用程序仍然没有收到收到并位于通知中心的通知。
以下是该应用程序遵循的要点:
{
aps = {
alert = {
body = "Push Notification Test Message";
title = Push Notification;
};
badge = 1;
"content-available" = 1;
sound = default;
};
"gcm.message_id" = "0:1499340350307980%361a2e5b361a2e5b";
m = "Push Notification Test Message";
tag = m;
}
Run Code Online (Sandbox Code Playgroud) objective-c push-notification apple-push-notifications ios firebase-cloud-messaging
我在使用生产 APN 认证的 Twilio Chat 上接收通知时遇到问题,收到错误消息:
错误 - 52131 APNs 凭据无效 可能的原因 凭据(证书和私钥)无效。证书已过期。可能的解决方案确保您的凭据中提供了有效的证书和私钥。
当我测试我的沙箱 APN 证书时,推送通知工作正常。
但是,当我创建 APN 推送服务认证并上传这些并将它们链接到我的可编程聊天功能时,我收到错误消息:52131 - 无效的 APNs 凭据... https://www.twilio.com/console/runtime/debugger/NOf2857a6c1db54e27984dd8fa9ff5100f
需要澄清的是,推送通知在我的开发项目中完美运行。我使用 Sandbox APN 证书,并选择 Sandbox 复选框
但是在生产版本中,我使用的是:
我在一些对类似问题的回复中读到,沙盒和推送服务 APN 证书位于同一应用程序 ID 中?或者不使用相同的CertificateSigningRequest来生成沙箱和PUSH?为什么这会产生影响?
这是线程:https://github.com/twilio/voice-quickstart-objc/issues/101
push-notification apple-push-notifications twilio twilio-programmable-chat
我想知道何时使用沙箱 APNS (gateway.sandbox.push.apple.com) 以及何时使用生产 APNS (gateway.push.apple.com) 发送推送通知。
目前我们正在使用生产 APNS
本地(调试)版本的应用程序和沙箱 APNS。它是否正确?
问题是,虽然我们正确地收到了 App Store 版本的推送通知,但我们没有收到 testflight 和本地版本的推送通知。
我们对所有版本使用相同的生产证书。它是否正确?
我有一个班级(PushNotificationSender)。该类拥有一个名为 的函数,sendPushNotification该函数接受FCM Token、Notification title、 和Notification body。鉴于我知道他们的FCM Token.
我的目标:使用此功能向多个用户发送相同的通知。
我尝试为每个用户调用它,FCM Token并且还尝试更改函数的参数以获取一组令牌,而不仅仅是一个,但还没有任何效果。关于如何完成升级有什么想法吗?
PushNotificationSender:
class PushNotificationSender {
init() {}
// MARK: Public Functions
public func sendPushNotification(to token: String, title: String, body: String, completion: @escaping () -> Void) {
let urlString = "https://fcm.googleapis.com/fcm/send"
let url = NSURL(string: urlString)!
let paramString: [String : Any] = ["to" : token,
"notification" : ["title" : title, "body" : body],
"data" : ["user" : …Run Code Online (Sandbox Code Playgroud) push-notification apple-push-notifications nsjsonserialization swift firebase-cloud-messaging
我的 iOS 应用程序可以通过操作按钮接收推送通知:
点击按钮通过 UrlSession 和数据任务发送 post http 请求。当应用程序暂停或未运行时,它可以很好地工作。但当应用程序处于后台时,例如当用户刚刚从底部向上滑动(或按下主页按钮)时,它不起作用。推送操作会处理,但 http 请求不会发送。
从我的 iPhone 的控制台 os_logs 中,我看到 UrlSession 无法从后台建立连接并抛出错误 Code=-1005“网络连接丢失。”。我一杀掉应用程序就可以了。我尝试了不同的 url 会话配置、后台 url 会话、后台任务,但没有任何效果。我发现的唯一解决方法是使用exit(0)fromapplicationDidEnterBackground方法,但强烈不建议以编程方式终止应用程序。
问题:当应用程序处于后台时,如何通过推送通知操作建立 http 连接?
我的代码:
class NotificationService: NSObject, UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
// notification processing if app is in foreground
...
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let requestId = String(describing: response.notification.request.content.userInfo["requestId"] …Run Code Online (Sandbox Code Playgroud) 您好,我正在尝试快速读取推送通知的标题或正文变量。出于测试目的,我创建了一个 .apns 文件,并使用 xcrun 运行该文件
apns 文件如下所示:
{
"aps" : {
"alert" : {
"title" : "Dein Freund ist am Joggen",
"body" : "Schick ihm ne Anfrage bro ",
"action-loc-key" : "PLAY"
},
"badge" : 5
},
"acme1" : "bar",
"acme2" : [ "bang", "whiz" ]
}
Run Code Online (Sandbox Code Playgroud)
这是我用于推送通知按下的功能。Userinfo 是完整的消息,它返回此代码下方的输出。现在我需要 .title 或 .body 变量,如何获取它们?
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
// Print message ID.
if let messageID = userInfo[gcmMessageIDKey] …Run Code Online (Sandbox Code Playgroud) 我正在阅读一篇raywenderlich.com关于推送通知入门的文章,因为我想在我的应用程序上尝试一下,并且能够轻松地跟进,直到在终端中运行命令并实际模拟通知的部分。
当我运行该命令时xcrun simctl push 'device identifier here' site.bundleidentifier.example eventnotification.apn,我收到一条错误消息Invalid device: 'device identifier here'。我似乎无法弄清楚这个问题,我直接从 Xcode 获得了标识符。我转到“窗口”->“设备和模拟器”->“设备”并获取手机的标识符。我似乎不知道如何解决该错误,如果有人知道我如何解决这个问题,那就太好了,谢谢。
你们中有些人可能知道,Xcode 11.4+ 版本终于支持在模拟器内测试通知。我们可以通过将 .apns 文件拖到模拟器中进行测试,或者运行以下命令:
xcrun simctl push <DEVICE_ID/NAME> ./notification-test.apns
Run Code Online (Sandbox Code Playgroud)
.apns 文件的结构如下:
xcrun simctl push <DEVICE_ID/NAME> ./notification-test.apns
Run Code Online (Sandbox Code Playgroud)
现在我正在测试我的React Native应用程序,它监听来自firebase 消息传递的通知。
我想测试data内部通知消息,但不起作用。
我怎样才能实现模拟 Firebase 消息传递的测试通知,以便messaging().getInitialNotification()其他 Firebase 功能可以捕获?
apple-push-notifications ios-simulator firebase react-native
ios ×6
swift ×4
apn ×1
applepay ×1
firebase ×1
objective-c ×1
passbook ×1
react-native ×1
testflight ×1
twilio ×1
uikit ×1
wallet ×1
xcode ×1