pushsharp.apple.dll p12放在哪

在. net平台下,推送IOS,Android,Windows Phone消息
时间: 12:19:25
&&&& 阅读:211
&&&& 评论:
&&&& 收藏:0
标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&1,新建项目,在项目中添加引用,dll文件已经上传在百度网盘,
2,引入命名空间
using PushS
using PushSharp.A
using PushSharp.A
using PushSharp.C
using PushSharp.W
using PushSharp.WindowsP
3,初始化写入下面代码
var push = new PushBroker();
//Wire up the events for all the services that the broker registers
push.OnNotificationSent += NotificationS
push.OnChannelException += ChannelE
push.OnServiceException += ServiceE
push.OnNotificationFailed += NotificationF
push.OnDeviceSubscriptionExpired += DeviceSubscriptionE
push.OnDeviceSubscriptionChanged += DeviceSubscriptionC
push.OnChannelCreated += ChannelC
push.OnChannelDestroyed += ChannelD
//-------------------------
// 苹果推送
//-------------------------
//Configure and start Apple APNS
// IMPORTANT: 获取正确的证书
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../Resources/PushSharp.Apns.Sandbox.p12"));
//IMPORTANT: 正确的密码
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "CERTIFICATE PASSWORD HERE")); //Extension method
//开始推送
push.QueueNotification(new AppleNotification()
.ForDeviceToken("设备的TokenID")
.WithAlert("Hello World!")
.WithBadge(7)
.WithSound("sound.caf"));
//---------------------------
// ANDROID GCM 推送
//---------------------------
//Configure and start Android GCM
//IMPORTANT: 正确的Google API‘s key
push.RegisterGcmService(new GcmPushChannelSettings("YOUR Google API‘s Console API Access
API KEY for Server Apps HERE"));
//IMPORTANT: 手机设备注册号
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("手机设备注册号")
.WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound.caf\"}"));
//-----------------------------
// WINDOWS PHONE 推送
//-----------------------------
//Configure and start Windows Phone Notifications
push.RegisterWindowsPhoneService();
push.QueueNotification(new WindowsPhoneToastNotification()
.ForEndpointUri(new Uri("设备注册CHANNEL URI"))
.ForOSVersion(WindowsPhoneDeviceOSVersion.MangoSevenPointFive)
.WithBatchingInterval(BatchingInterval.Immediate)
.WithNavigatePath("/MainPage.xaml")
.WithText1("PushSharp")
.WithText2("This is a Toast"));
Console.WriteLine("Waiting for Queue to Finish...");
push.StopAllServices();
Console.WriteLine("Queue Finished, press return to exit...");
Console.ReadLine();
4,实现注册方法
static void DeviceSubscriptionChanged(object sender, string oldSubscriptionId, string newSubscriptionId, INotification notification)
//Currently this event will only ever happen for Android GCM
Console.WriteLine("Device Registration Changed:
Old-& " + oldSubscriptionId + "
New-& " + newSubscriptionId + " -& " + notification);
static void NotificationSent(object sender, INotification notification)
Console.WriteLine("Sent: " + sender + " -& " + notification);
static void NotificationFailed(object sender, INotification notification, Exception notificationFailureException)
Console.WriteLine("Failure: " + sender + " -& " + notificationFailureException.Message + " -& " + notification);
static void ChannelException(object sender, IPushChannel channel, Exception exception)
Console.WriteLine("Channel Exception: " + sender + " -& " + exception);
static void ServiceException(object sender, Exception exception)
Console.WriteLine("Channel Exception: " + sender + " -& " + exception);
static void DeviceSubscriptionExpired(object sender, string expiredDeviceSubscriptionId, DateTime timestamp, INotification notification)
Console.WriteLine("Device Subscription Expired: " + sender + " -& " + expiredDeviceSubscriptionId);
static void ChannelDestroyed(object sender)
Console.WriteLine("Channel Destroyed for: " + sender);
static void ChannelCreated(object sender, IPushChannel pushChannel)
Console.WriteLine("Channel Created for: " + sender);
5,大功告成,每一种系统都需要不同的验证信息,有完整的信息在使用本例子(比如ios证书,密码,设备tokenID等),亲自测过,正常!
6,有什么不懂的地方和我联系()标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&原文:http://www.cnblogs.com/shixudong/p/3606003.html
教程昨日排行
&&国之画&&&& &&&&&&
&& &&&&&&&&&&&&&&
鲁ICP备号-4
打开技术之扣,分享程序人生!I've developed an iOS app, that receives Push Notifications. I'm sending them from a .NET environment using PushSharp. Everything went beautifully while developing, and the Pushs were successfully sent:
var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Development.p12");
push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(token)
.WithContentAvailable(1)
push.StopAllServices();
Now, the app has been approved, and it's at AppStore. I have generate the correct production certificate:
var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Production.p12");
push.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(token)
.WithContentAvailable(1)
push.StopAllServices();
but when I try to send the push from PushSharp, it throws the following exception:
You have selected the Production server, yet your Certificate does not appear to be the Production certificate! Please check to ensure you have the correct certificate!
I'm pretty sure I've followed all the steps. I've downloaded the production certificate that was binded with the provisioning file set in the app to publish. Opened it and exported the .p12.
I'm also sure I'm not using a development one by accident, because, if I set PushSharp for development, using this last certificate, it throws the following error:
You have selected the Development/Sandbox (Not production) server, yet your Certificate does not appear to be the Development/Sandbox (Not production) certificate! Please check to ensure you have the correct certificate!
How can the certificate be neither Development, nor Production?
Is there somewhere I can validate the file? Please give me some insigth on this matter, as I have no clue where to start
解决方案 Apple has changed the name. Please go to ApplePushChannelSettings.cs and change the name as below.
if (production && !subjectName.Contains("Apple Production IOS Push Services"))
if (production && !subjectName.Contains("Apple Push Services"))
I need to do this when I renewing my expired cert yesterday. Change the name, rebuild it and upload to server, then it's working again.
本文地址: &
我已经开发iOS应用程序,接收推送通知。我是从一个.NET环境中使用PushSharp送他们。一切都很精美,同时开发和推手已成功发送:
VAR推=新PushBroker();VAR appleCert = File.ReadAllBytes(@“utils的\\ Cert.Development.p12”);push.RegisterAppleService(新ApplePushChannelSettings(假,appleCert,“*******”));push.QueueNotification(新AppleNotification()
.ForDeviceToken(令牌)
.WithContentAvailable(1));push.StopAllServices(); 现在,应用程序已经被批准,而且它在AppStore的。我有产生正确的生产许可证:
VAR推=新PushBroker();VAR appleCert = File.ReadAllBytes(@“utils的\\ Cert.Production.p12”);push.RegisterAppleService(新ApplePushChannelSettings(真实的,appleCert,“*******”));push.QueueNotification(新AppleNotification()
.ForDeviceToken(令牌)
.WithContentAvailable(1));push.StopAllServices(); 但是当我尝试发送从PushSharp推,它抛出以下异常: 您已经选择了生产服务器,但你的证书没有出现是生产合格证!请检查以确保您拥有正确的证书! 我是pretty肯定我已经照着所有的步骤。我已经下载了与在应用程序发布设置配置文件绑定的生产许可证。打开它,并出口中.P12。我也确信我不是用开发的一款意外,因为,如果我设置PushSharp发展,利用这最后的证书,它引发以下错误: 您已经选择了开发/测试区(不生产)服务器,但你的证书没有出现被开发/测试区(不生产)证书!请检查以确保您拥有正确的证书!
如何可以将证书既不开发,也不是生产? 有没有什么地方我可以验证文件?请给我一些insigth在这个问题上,因为我不知道从哪里开始。解决方案 苹果已经改变了名称。请到ApplePushChannelSettings.cs并更改名称如下图所示。从 如果(生产和放大器;&安培;!subjectName.Contains(“苹果IOS生产推送服务”)) 要 如果(生产和放大器;&安培;!subjectName.Contains(“苹果推送服务”)) 我要做到这一点,当我更新我的证书过期昨天。更改名称,重建它并上传到服务器,那么它的再次合作。
本文地址: &
扫一扫关注官方微信I am using PushSharp to send Apple Push Notification in C# , i have my production .pem file and its password. Below is my code snippet.Am always getting this error ..
"A call to SSPI failed, see inner exception. ---& System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted-"
"System.IO.IOException: Authentication failed because the remote party has closed the transport stream."
I tried almost all codes available in net.Even tried MoonAPNS but same error, For custom script also am getting this SSPI failure error. I use the same
.pem file and run a php script to send push notification to APN from same server,it works.
var push = new PushBroker();
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ck.pem"));
push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "pwd"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken("XXXXXXXXXXXXXXX")
.WithAlert("Hello World!")
.WithBadge(7)
.WithSound("sound.caf"));
LogManager.Info("Waiting for Queue to Finish..");
push.StopAllServices();
Please help
Thanks in advance
解决方案 I think your c# may be incorrect, To verify, rather than with a .pem, can you try with your p12 cert using the below code as a test...
Boolean bsandbox =
string p12fileName =AppDomain.CurrentDomain.BaseDirectory + "yourCert.p12";
string p12password = "1234";
string deviceID1 = "c699b2dcf719e67aac7e0fab791a72a086ffb788ba28f6a"; //
string msg = "This is the message sent at : ";
string alert = "Hello world at " + DateTime.Now.ToLongTimeString();
int badge = 1;
string soundstring = "default";
var payload1 = new NotificationPayload(deviceID1, alert, badge, soundstring);
payload1.AddCustom("custom1", msg);
var notificationList = new List&NotificationPayload& { payload1 };
var push = new PushNotification(bsandbox, p12fileName, p12password);
var rejected = push.SendToApple(notificationList);`
本文地址: &
我使用PushSharp送苹果推送通知在C#,我有我的生产.pem文件和密码。下面是我的code snippet.Am总是收到此错误。 “来SSPI调用失败,请参见内部异常---> System.ComponentModel.Win32Exception:接收到的消息是意外或严重formatted-” 或 “System.IO.IOException:身份验证失败,因为远程方已关闭传输流。” 我试过几乎所有codeS在net.Even可尝试MoonAPNS但同样的错误,对于自定义脚本也正在此SSPI失败错误。我用同样的.pem文件并运行PHP脚本推送通知从同一台服务器发送到APN,它的工作原理。
VAR推=新PushBroker();变种appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory“ck.pem”)); push.RegisterAppleService(新ApplePushChannelSettings(假,appleCert,“PWD”)); push.QueueNotification(新AppleNotification()
.ForDeviceToken(“XXXXXXXXXXXXXXX”)
.WithAlert(的“Hello World!”)
.WithBadge(7)
.WithSound(“sound.caf”));
LogManager.Info(“等待队列来完成。”);
push.StopAllServices(); 请帮忙在此先感谢解决方案 我觉得你的C#可能不正确,要进行验证,而不是用质子交换膜,你可以用你的P12尝试证书使用下面的code作为测试...
布尔bsandbox = TRUE;
字符串p12fileName = AppDomain.CurrentDomain.BaseDirectory +“yourCert.p12”
字符串p12password =“1234”;
字符串deviceID1 =“c699b2dcf719e67aac7e0fab791a72a086ffb788ba28f6a”; //
弦乐味精=“这是在发送的消息:”;
字符串警报=“你好世界的”+ DateTime.Now.ToLongTimeString();
INT徽章= 1;
字符串soundstring =“默认”;
VAR payload1 =新NotificationPayload(deviceID1,警告,徽章,soundstring);
payload1.AddCustom(“CUSTOM1”,味精);
VAR notificationList =新的List< NotificationPayload> {} payload1;
VAR推=新PushNotification(bsandbox,p12fileName,p12password);
VAR拒绝= push.SendToApple(notificationList);`
本文地址: &
扫一扫关注官方微信他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)ios - C# MDM Server with Apple, not able to send Push Notification - Stack Overflow
Join Stack Overflow to learn, share knowledge, and build your career.
or sign in with
We are working on a MDM solution for iOS devices.
We are already able to install profiles with a MDM-Payload over a website and we already receive PUT requestes sent by the iOS devices containing the PushMagic, a deviceToken and other values as well.
We created a COMPANY.pem SSL certificiate using this description:
We tried to send a Push Notification with the library push-sharp:
We were using MDM.p12 file build with these commands
openssl pkcs12 -export -in ./COMPANY.pem -inkey ./customerPrivateKey.pem -certfile ./CertificateSigningRequest.certSigningRequest -out MDM.p12
The program sending this notification does not throw any errors and exits normally.
But we are not receiving any Push-Notifications on our devices nor receiving anything through the feedback service.
Also to mention is that we tried to use the sandbox-server and the production-server as well.
Here is our code using the push-sharp library:
using System.Collections.G
using System.Collections.S
using System.IO;
using System.L
using System.T
using PushS
using PushSharp.A
namespace PushSharp.Sample
class Program
static void Main(string[] args)
//Create our service
PushService push = new PushService();
//Wire up the events
push.Events.OnDeviceSubscriptionExpired += new Common.ChannelEvents.DeviceSubscriptionExpired(Events_OnDeviceSubscriptionExpired);
push.Events.OnDeviceSubscriptionIdChanged += new Common.ChannelEvents.DeviceSubscriptionIdChanged(Events_OnDeviceSubscriptionIdChanged);
push.Events.OnChannelException += new Common.ChannelEvents.ChannelExceptionDelegate(Events_OnChannelException);
push.Events.OnNotificationSendFailure += new Common.ChannelEvents.NotificationSendFailureDelegate(Events_OnNotificationSendFailure);
push.Events.OnNotificationSent += new Common.ChannelEvents.NotificationSentDelegate(Events_OnNotificationSent);
//Configure and start Apple APNS
// IMPORTANT: Make sure you use the right Push certificate.
Apple allows you to generate one for connecting to Sandbox,
and one for connecting to Production.
You must use the right one, to match the provisioning profile you build your
//var appleCert = File.ReadAllBytes("C:\\TEMP\\apns-mdm.p12");
var appleCert = File.ReadAllBytes(@".\MDM.p12");
//IMPORTANT: If you are using a Development provisioning Profile, you must use the Sandbox push notification server
(so you would leave the first arg in the ctor of ApplePushChannelSettings as 'false')
If you are using an AdHoc or AppStore provisioning profile, you must use the Production push notification server
(so you would change the first arg in the ctor of ApplePushChannelSettings to 'true')
push.StartApplePushService(new ApplePushChannelSettings(true, appleCert, "PWD"));
//String p12File = @".\apns-mdm.p12";
//String p12Password = "PWD";
String pushMagicString = "B2-4122-A1DC-72ACD64E6AFB";
//String deviceToken = "27asObngxvVNb3RvRMs3XVaEWC1DNa3TjFE12stKsig=";
//Configure and start Android GCM
//IMPORTANT: The SENDER_ID is your Google API Console App Project ID.
Be sure to get the right Project ID from your Google APIs Console.
It's not the named project ID that appears in the Overview,
but instead the numeric project id in the url: eg: https://code.google.com/apis/console/?pli=1#project::overview
is the project id, which is the SENDER_ID to use!
//push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings("", "AIzaSyC2PZNXQDVaUpZGmtsF_Vp8tHtIABVjazI", "com.pushsharp.test"));
//Configure and start Windows Phone Notifications
//push.StartWindowsPhonePushService(new WindowsPhone.WindowsPhonePushChannelSettings());
//Fluent construction of a Windows Phone Toast notification
//push.QueueNotification(NotificationFactory.WindowsPhone().Toast()
//.ForEndpointUri(new Uri("http://sn1.notify.live.net/throttledthirdparty/01.00/AAFCoNoCXidwRpn5NOxvwSxPAgAAAAADAgAAAAQUZm52OkJCMjg1QTg1QkZDMkUxREQ"))
//.ForOSVersion(WindowsPhone.WindowsPhoneDeviceOSVersion.MangoSevenPointFive)
//.WithBatchingInterval(WindowsPhone.BatchingInterval.Immediate)
//.WithNavigatePath("/MainPage.xaml")
//.WithText1("PushSharp")
//.WithText2("This is a Toast"));
//Fluent construction of an iOS notification
//IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate
for registered for remote notifications is called, and the device token is passed back to you
String test = "3d 58 64 4d 90 d3 18 09 22 5c 50 d2 12 16 b5 67 71 1e be 5c 13 6e 41 3c 3e 81 b5 52 30 68 09 a5";
test = test.Replace(" ", string.Empty);
Console.WriteLine("Device Token length is: " + test.Length);
Console.WriteLine("DeviceToken is: " + test);
Console.WriteLine("PushMagic is: " + pushMagicString);
DateTime dayAfterTomorrow = DateTime.Now.AddDays(2);
Console.WriteLine("Expiry date is: " + dayAfterTomorrow.ToString());
push.QueueNotification(NotificationFactory.Apple()
.ForDeviceToken(test).WithExpiry(dayAfterTomorrow).WithCustomItem("mdm", pushMagicString));
//push.Events.RaiseNotificationSent(NotificationFactory.Apple()
.ForDeviceToken(hex).WithCustomItem("mdm", pushMagicString));
//Fluent construction of an Android GCM Notification
//push.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId("APA91bG7J-cZjkURrqi58cEd5ain6hzi4i06T0zg9eM2kQAprV-fslFiq60hnBUVlnJPlPV-4K7X39aHIe55of8fJugEuYMyAZSUbmDyima5ZTC7hn4euQ0Yflj2wMeTxnyMOZPuwTLuYNiJ6EREeI9qJuJZH9Zu9g")
.WithCollapseKey("NONE")
.WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"7\"}"));
Console.WriteLine("Waiting for Queue to Finish...");
//Stop and wait for the queues to drains
push.StopAllServices(true);
Console.WriteLine("Queue Finished, press return to exit...");
Console.ReadLine();
static void Events_OnDeviceSubscriptionIdChanged(Common.PlatformType platform, string oldDeviceInfo, string newDeviceInfo)
//Currently this event will only ever happen for Android GCM
Console.WriteLine("Device Registration Changed:
Old-& " + oldDeviceInfo + "
New-& " + newDeviceInfo);
static void Events_OnNotificationSent(Common.Notification notification)
Console.WriteLine("Sent: " + notification.Platform.ToString() + " -& " + notification.ToString());
static void Events_OnNotificationSendFailure(Common.Notification notification, Exception notificationFailureException)
Console.WriteLine("Failure: " + notification.Platform.ToString() + " -& " + notificationFailureException.Message + " -& " + notification.ToString());
static void Events_OnChannelException(Exception exception)
Console.WriteLine("Channel Exception: " + exception.ToString());
static void Events_OnDeviceSubscriptionExpired(Common.PlatformType platform, string deviceInfo)
Console.WriteLine("Device Subscription Expired: " + platform.ToString() + " -& " + deviceInfo);
We encoded the received deviceToken using this website:
from base64 to HEX.
We are also using the APS/PC Logging profile on our iOS device to get more output through the debug console provided by IPCU.
2,65673968
The message sent to the Push Notification Service must NOT contain the aps key. The message should only contain the PushMagic string as the value of the mdm key. For example, using the value you defined as the pushMagicString, the message to the Push Notification Service should look like this:
{"mdm":"B2-4122-A1DC-72ACD64E6AFB"}
I have not used the push-sharp library you are using. However, I briefly looked through the code and it seems like the AppleNotificationPayload.ToJson method is always adding an aps key to the message. I suggest commenting out line 114 and then trying it. Here is the ToJson method with the line commented out:
public string ToJson()
JObject json = new JObject();
JObject aps = new JObject();
if (!this.Alert.IsEmpty)
if (!string.IsNullOrEmpty(this.Alert.Body)
&& string.IsNullOrEmpty(this.Alert.LocalizedKey)
&& string.IsNullOrEmpty(this.Alert.ActionLocalizedKey)
&& (this.Alert.LocalizedArgs == null || this.Alert.LocalizedArgs.Count &= 0)
&& !this.HideActionButton)
aps["alert"] = new JValue(this.Alert.Body);
JObject jsonAlert = new JObject();
if (!string.IsNullOrEmpty(this.Alert.LocalizedKey))
jsonAlert["loc-key"] = new JValue(this.Alert.LocalizedKey);
if (this.Alert.LocalizedArgs != null && this.Alert.LocalizedArgs.Count & 0)
jsonAlert["loc-args"] = new JArray(this.Alert.LocalizedArgs.ToArray());
if (!string.IsNullOrEmpty(this.Alert.Body))
jsonAlert["body"] = new JValue(this.Alert.Body);
if (this.HideActionButton)
jsonAlert["action-loc-key"] = new JValue((string)null);
else if (!string.IsNullOrEmpty(this.Alert.ActionLocalizedKey))
jsonAlert["action-loc-key"] = new JValue(this.Alert.ActionLocalizedKey);
aps["alert"] = jsonA
if (this.Badge.HasValue)
aps["badge"] = new JValue(this.Badge.Value);
if (!string.IsNullOrEmpty(this.Sound))
aps["sound"] = new JValue(this.Sound);
if (this.ContentAvailable.HasValue)
aps["content-available"] = new JValue(this.ContentAvailable.Value);
//json["aps"] =
foreach (string key in this.CustomItems.Keys)
if (this.CustomItems[key].Length == 1)
json[key] = new JValue(this.CustomItems[key][0]);
else if (this.CustomItems[key].Length & 1)
json[key] = new JArray(this.CustomItems[key]);
string rawString = json.ToString(Newtonsoft.Json.Formatting.None, null);
StringBuilder encodedString = new StringBuilder();
foreach (char c in rawString)
if ((int)c & 32 || (int)c & 127)
encodedString.Append("\\u" + String.Format("{0:x4}", Convert.ToUInt32(c)));
encodedString.Append(c);
return rawS// encodedString.ToString();
have you made sure that during MDM enrollment, the MDM payload (PayloadType = com.apple.mdm) you deliver has the correct Topic?
i.e. in your APN push cert that you've downloaded from apple.you'll see something like
CN = com.apple.mgmt.external.[GUID].
This needs to be the same value delivered to your IOS device during MDM enrollment.
If APN does not give any error during the message upload, or the feedback service does not return the deviceID which indicates that the device is not available, it should mean that it will be delivered correctly to the device.
The next phase is to determine if the IOS device is setup to listen to the APN message via this topic.
You can try connecting your device to XCode or IPCU, in the console logs, it will contain logs indicating if APN was able to successfully deliver this message using the agreed upon topic.
Here's also an article on troubleshootin APN
there's a downloadable profile in the above article that you can load to your device for additional verbose logging.
The Push-sharp library seems designed for application notification. To make it work for MDM notification you can fix the function AppleNotificationPayload.ToJson, line 114 by
if (aps.HasValues == true)
json["aps"] =
This fix will make sure "aps" key will be included only for application notification. And the library could be used for both MDM notification and application notification.
The "aps" key will be ignored by the ios. You can see the screenshot log. It ignore the "aps" and execute the clearpasscode command successfully.
19.3k135767
this answer work well
var pushService = new PushService();
// attach event listeners
// override the production/development auto-detection as it doesn't
// work for MDM certificates
var cert = // load your push client certificate
var channel = new ApplePushChannelSettings(true, cert, true);
pushService.StartApplePushService(channel);
// create and send the notification
var notification = NotificationFactory
.ForDeviceToken("your-device-token-received-from-checkin")
.WithExpiry(DateTime.UtcNow.AddDays(1))
.WithCustomItem("mdm", "your-push-magic-received-in-checkin");
pushService.QueueNotification(notification);
Even I m trying to send Push N i have also followed same process and commands.
One thing i have noticed in your code that you have commented deviceToken recieved from "MessageType:TokenUpdate"
//String deviceToken = "27asObngxvVNb3RvRMs3XVaEWC1DNa3TjFE12stKsig=";
And you are using following variable "test" as device token, to send Push Notification.
String test = "3d 58 64 4d 90 d3 18 09 22 5c 50 d2 12 16 b5 67 71 1e be 5c 13 6e 41 3c 3e 81 b5 52 30 68 09 a5";
test = test.Replace(" ", string.Empty);
When i use device token from "MessageType:TokenUpdate"; pushsharp is giving me error
APNS NotificationFailureException -> 8 : Invalid token
do i need to use something else as devicetoken, if yes where can i get that value.
Please reply.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 pushsharp.apple.dll 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信