【问题标题】:Push Sharp to send push Notification to IOS AppPush Sharp 向 IOS App 发送推送通知
【发布时间】:2015-03-25 13:02:47
【问题描述】:

我正在制作一个用于向 IOS App 发送推送通知的网络服务。我正在尝试使用 Puch Sharp 。在网络上,我得到了 Push Sharp 1.1 示例的示例,但现在是 2.2。

这是 1.1 版的代码。有人可以告诉我在 2.2 版中使用什么来向 IOS App 发送推送通知。

    '    ''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))

【问题讨论】:

    标签: ios asp.net vb.net apple-push-notifications pushsharp


    【解决方案1】:
    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"));
    

    您可以从here找到最新的样本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多