PushSharp通知错误

时间:2013-02-12 16:23:04

标签: push-notification apple-push-notifications pushsharp

使用PushSharp时,我一直收到此错误:

Waiting for Queue to Finish...
Failure: Apple -> Exception of type 'PushSharp.Apple.NotificationFailureException' was thrown. -> {"aps":{"alert":"Alert Text From .NET!","badge":7,"sound":"default"}}
Queue Finished, press return to exit...

有什么想法吗? 当您插入手机时,我使用DeviceToken作为iTunes中显示的长UID。根据PushSharp Wiki上的说明导出证书(Sandbox)。

1 个答案:

答案 0 :(得分:2)

您使用的不是设备令牌。设备令牌是32个字节(也可以表示为64个HEX字符的字符串)。您的iOS应用程序在注册推送通知时从Apple获取它。

- (void)applicationDidFinishLaunching:(UIApplication *)app {

   // other setup tasks here....

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

}



// Delegation methods

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {

    const void *devTokenBytes = [devToken bytes];

    self.registered = YES;

    [self sendProviderDeviceToken:devTokenBytes]; // custom method

}