Push Sharp发送推送通知到IOS应用。

时间:2022-09-10 20:20:35

I am making a web service for sending push notification to IOS App . I am trying to use Puch Sharp . On web i get the example for Push Sharp 1.1 example but now it is 2.2.

我正在做一个web服务来发送推送通知到IOS应用。我正试着用普奇。在web上,我得到了Push Sharp 1.1的例子,但现在是2.2。

This is the code for version 1.1 . Can some body please tell me what to use in version 2.2 for sending a push notification to IOS App.

这是1.1版本的代码。请告诉我在2.2版本中使用什么来发送推送通知到IOS应用程序。

    '    ''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
    '    ''   app with!
    Dim appleCert() As Byte = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "~/DocketTrak_Development.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(False, appleCert, "trakDock3%", False))

1 个解决方案

#1


0  

var push = new PushBroker();

var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"../../../Resources/PushSharp.Apns.Sandbox.p12"));

push.RegisterAppleService(new ApplePushChannelSettings(appleCert,
"CERTIFICATE PASSWORD HERE"));

push.QueueNotification(new AppleNotification()
                                       .ForDeviceToken("DEVICE TOKEN HERE")
                                       .WithAlert("Hello World!")
                                       .WithBadge(7)
                                       .WithSound("sound.caf"));

You can find the latest samples from here

你可以在这里找到最新的样品。

#1


0  

var push = new PushBroker();

var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"../../../Resources/PushSharp.Apns.Sandbox.p12"));

push.RegisterAppleService(new ApplePushChannelSettings(appleCert,
"CERTIFICATE PASSWORD HERE"));

push.QueueNotification(new AppleNotification()
                                       .ForDeviceToken("DEVICE TOKEN HERE")
                                       .WithAlert("Hello World!")
                                       .WithBadge(7)
                                       .WithSound("sound.caf"));

You can find the latest samples from here

你可以在这里找到最新的样品。