百韵网 >>  正文

Invalid token怎么解决 Invalid token怎么解决

来源:www.baiyundou.net   日期:较早时间
private void Form1_Load(object sender, EventArgs e)
{
string token = "8d6c30144e7a93e73cc1fafb0a5000000001a0a0bd1f66c9e0ab857291d00000";
StarServices("production_identity.p12", "123123");
SendSingleMess(token, "这是通过APNS的推送消息");
}
public void StarServices(string keyPath, string keyWord)
{
try
{
push.OnNotificationSent += NotificationSent;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnChannelCreated += ChannelCreated; //
push.OnChannelDestroyed += ChannelDestroyed; //
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, keyPath));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, keyWord));
}
catch { }
}
public void StopServices()
{
try
{
push.StopAllServices();
}
catch { }
}
public void SendSingleMess(string tokenID, string message)
{
try
{
push.QueueNotification(new AppleNotification()
.ForDeviceToken(tokenID)
.WithAlert(message)
.WithBadge(7)
.WithSound("sound.caf"));
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("error:" + e.Message);
}
}

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);
}

格式不正确(无效的凭证)突出在1号线.xml

Invalid token怎么解决~

private void Form1_Load(object sender, EventArgs e)
{
string token = "8d6c30144e7a93e73cc1fafb0a5000000001a0a0bd1f66c9e0ab857291d00000";
StarServices("production_identity.p12", "123123");
SendSingleMess(token, "这是通过APNS的推送消息");
}
public void StarServices(string keyPath, string keyWord)
{
try
{
push.OnNotificationSent += NotificationSent;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnChannelCreated += ChannelCreated; //
push.OnChannelDestroyed += ChannelDestroyed; //
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, keyPath));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, keyWord));
}
catch { }
}
public void StopServices()
{
try
{
push.StopAllServices();
}
catch { }
}
public void SendSingleMess(string tokenID, string message)
{
try
{
push.QueueNotification(new AppleNotification()
.ForDeviceToken(tokenID)
.WithAlert(message)
.WithBadge(7)
.WithSound("sound.caf"));
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("error:" + e.Message);
}
}

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);
}

……

private void Form1_Load(object sender, EventArgs e)
{
string token = "8d6c30144e7a93e73cc1fafb0a5000000001a0a0bd1f66c9e0ab857291d00000";
StarServices("production_identity.p12", "123123");
SendSingleMess(token, "这是通过APNS的推送消息");
}
public void StarServices(string keyPath, string keyWord)
{
try
{
push.OnNotificationSent += NotificationSent;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnChannelCreated += ChannelCreated; //
push.OnChannelDestroyed += ChannelDestroyed; //
var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, keyPath));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, keyWord));
}
catch { }
}
public void StopServices()
{
try
{
push.StopAllServices();
}
catch { }
}
public void SendSingleMess(string tokenID, string message)
{
try
{
push.QueueNotification(new AppleNotification()
.ForDeviceToken(tokenID)
.WithAlert(message)
.WithBadge(7)
.WithSound("sound.caf"));
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("error:" + e.Message);
}
}

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);
}

……

相关要点总结:
(编辑:本站网友)
相关推荐
关于我们 | 客户服务 | 服务条款 | 联系我们 | 免责声明 | 网站地图
@ 百韵网