我正在为我的应用程序开发推送通知,我用PHP编写提供程序,它工作正常.我以前使用我的开发版和Apple的沙盒服务器测试推送通知,一切正常,现在我试图让它与AdHoc版本一起工作,但我从未在手机上收到任何消息.这是我做的:
我真的没有想法可能有什么不对,有人有想法吗?非常感谢!
我需要将通知推送到我的应用安装的数万个iOS设备.我正在尝试使用PushSharp,但我在这里缺少一些基本概念.起初我尝试在Windows服务中实际运行它,但无法使其工作 - 从_push.QueueNotification()调用获取空引用错误.然后我完成了所记录的示例代码所做的工作并且它有效:
PushService _push = new PushService();
_push.Events.OnNotificationSendFailure += new ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure);
_push.Events.OnNotificationSent += new ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent);
var cert = File.ReadAllBytes(HttpContext.Current.Server.MapPath("..pathtokeyfile.p12"));
_push.StartApplePushService(new ApplePushChannelSettings(false, cert, "certpwd"));
AppleNotification notification = NotificationFactory.Apple()
.ForDeviceToken(deviceToken)
.WithAlert(message)
.WithSound("default")
.WithBadge(badge);
_push.QueueNotification(notification);
_push.StopAllServices(true);
Run Code Online (Sandbox Code Playgroud)
问题#1:这很好用,我看到iPhone上的通知弹出.但是,由于它被称为推送服务,我认为它的行为就像一个服务 - 意思是,我实例化它并在Windows服务中调用_push.StartApplePushService().我想实际排队我的通知,我可以在前端做这个(管理员应用程序,让我们说):
PushService push = new PushService();
AppleNotification notification = NotificationFactory.Apple()
.ForDeviceToken(deviceToken)
.WithAlert(message)
.WithSound("default")
.WithBadge(badge);
push.QueueNotification(notification);
Run Code Online (Sandbox Code Playgroud)
显然(就像我已经说过的那样),它没有用 - 最后一行不断抛出空引用异常.
我很难找到任何其他类型的文档来展示如何以服务/客户端方式设置它(而不是一次调用所有内容).是否有可能或者我错过了应该如何利用PushSharp的观点?
问题2:此外,我似乎无法找到一种方法同时定位多个设备令牌,而无需循环遍历它们并一次排队一个通知.这是唯一的方法还是我在这里错过了什么?
提前致谢.
.net c# push-notification apple-push-notifications pushsharp
有没有办法更新徽章中的号码而不显示提醒或打开应用程序?
我正在编写一个应该始终在图标徽章中显示当前未读消息数的应用程序,但我想这样做而不向用户显示任何警报.
我正在为iOS 5.0+开发.
编辑:更清楚的是,当应用程序未运行时,我正在询问一种方法.我希望服务器在没有显示警报的情况下推送新的徽章号码.这可能吗?
我正在使用https://code.google.com/p/apns-php/上提供的apns php服务器.
我已经设置了推送通知证书但我的代码仍然在连接时抛出错误.
这有什么问题?以下是我获取设备令牌的方法:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
#if !TARGET_IPHONE_SIMULATOR
// Prepare the Device Token for Registration (remove spaces and < >)
NSString *deviceToken = [[[[devToken description]
stringByReplacingOccurrencesOfString:@"<"withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"%@", deviceToken);
#endif
}
Run Code Online (Sandbox Code Playgroud)
这是我运行服务器时的错误:
Sat, 11 May 2013 13:37:53 -0700 ApnsPHP[18198]: INFO: Trying
ssl://gateway.push.apple.com:2195...
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Connected to ssl://gateway.push.apple.com:2195.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Sending messages queue, run #1: 1 message(s) …Run Code Online (Sandbox Code Playgroud) php objective-c push-notification apple-push-notifications apns-php
大家好,我一直在做推送通知.我也可以通过适当的脚本通过网站发送推送通知.我正在阅读网站推送ID,您可以直接从您的网站发送推送消息到os x.不知道它有什么不同?OS X意味着iphone/ipad设备和mac?
我正在尝试基于PyAPN实现iphone的推送通知
当我在本地运行它但它阻止并提示我手动输入密码短语,直到我这样做才行
我不知道如何设置它以便在没有提示的情况下工作
这是我的代码:
from apns import APNs, Payload
import optparse
import os
certificate_file = here(".." + app.fichier_PEM.url )
token_hex = '0c99bb3d077eeacdc04667d38dd10ca1a'
pass_phrase = app.mot_de_passe
apns = APNs(use_sandbox=True, cert_file= certificate_file)
payload = Payload(alert = message.decode('utf-8'), sound="default", badge=1)
apns.gateway_server.send_notification(token_hex, payload)
# Get feedback messages
for (token_hex, fail_time) in apns.feedback_server.items():
print "fail: "+fail_time
Run Code Online (Sandbox Code Playgroud) python django push-notification apple-push-notifications django-1.2
我一直在使用Ray Wenderlich的使用PHP脚本推送通知的教程.
参考:http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
http://www.raywenderlich.com/32963/apple-push-notification-services-in-ios-6-tutorial-part-2
我已经做了大量的研究,但我在第2部分遇到了一个问题,你使用ck.pem文件运行push.php文件.
/Applications/XAMPP/bin/php push.php development
我唯一的区别是我使用XAMPP而不是MAMP.
我已确认已安装所有扩展程序.
我可以通过以下方式测试终端中的证书:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushChatCert.pem -key PushChatKey.pem
它要求我输入我的密码并且我这样做.一切都在终端成功运作.
但是,当我运行push.php文件时,我收到以下错误:
PHP警告:stream_socket_client():SSL操作失败,代码为1. OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败PHP警告:stream_socket_client():无法启用加密
PHP警告:stream_socket_client():无法连接到第140行的ssl://gateway.sandbox.push.apple.com:2195(未知错误)
php文件中的第140行是:
$this->fp = stream_socket_client('ssl://' . $this->server, $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
我找到了这些:
https://devforums.apple.com/message/1054840#1054840
我确实重复了一切.我知道我的密码是正确的.我重新创建了我的证书,pem文件和密钥.什么都行不通.每次我这样做都会出现同样的错误.
我太困惑了.
有没有人有任何建议或知道发生了什么?
谢谢!
更新1:
我也尝试设置ck.pem文件的完整路径,该文件也没有修复错误.
我已经构建了一个带有颤动的应用程序,就像提醒一样.
即使应用程序已关闭,如何向用户显示通知?
mobile-application push-notification apple-push-notifications android-notifications flutter
所以我的朋友从OneSignal收到了这封电子邮件
由于即将到来的iOS 13版本可能会发生更改,因此在使用Xcode 11构建应用程序之前,必须先更新到最新版本的iOSSDK。OneSignal的所有包装SDK(包括React Native,Unity和Flutter)都已经过也更新了。原因是与iOS 13一起发布的Xcode 11打破了OneSignal之类的应用程序和库用于获取设备推送令牌的通用技术。如果您不使用我们的新SDK,那么新用户将无法从您的应用订阅通知。
我对此感到好奇。
这是我们在iOS 12上获取设备通知令牌的方式
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
var token = ""
for i in 0..<deviceToken.count {
token = token + String(format: "%02.2hhx", arguments: [deviceToken[i]])
}
print("Notification token = \(token)")
}
Run Code Online (Sandbox Code Playgroud)
在iOS 13上获取它的正确方法是什么?我应该为当前开发的应用程序采用新方法还是旧方法仍然可行?