xcode 从 ios 应用程序发送推送通知
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13215510/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Send push notification from ios app
提问by Franck
I need to create a ios app who send notification. (similar to Pushmebaby (https://github.com/stefanhafeneger/PushMeBaby)). (also note that this mac app was 2 years old ans crash for me)
我需要创建一个发送通知的 ios 应用程序。(类似于 Pushmebaby (https://github.com/stefanhafeneger/PushMeBaby))。(还要注意,这个 mac 应用程序是 2 岁,对我来说崩溃了)
I've seen some exemple of php web site to do this, buy nothing to be able to do this directly from ios.
我已经看到一些 php 网站的例子来做到这一点,买什么都可以直接从 ios 做到这一点。
Any good exemple for me?
有什么好的例子给我吗?
Thanks, and have a nice day!
感谢,并有一个愉快的一天!
回答by Jesse Bunch
Are you needing to send notifications to the iOS device that is currently running your app? If so, you should look into local notifications.
您是否需要向当前运行您的应用的 iOS 设备发送通知?如果是这样,您应该查看本地通知。
If you're actually wanting to send push notifications to other iOS devices from your iOS device, you basically have two options
如果你真的想从你的 iOS 设备向其他 iOS 设备发送推送通知,你基本上有两个选择
Option 1 (Easiest)
选项 1(最简单)
Use a service like Parseor Urban Airshipto send the notifications for you. You can then fire off a request to their API to initiate the push notification to your user's devices.
使用Parse或Urban Airship等服务为您发送通知。然后,您可以向他们的 API 发出请求,以启动对用户设备的推送通知。
Option 2 (Most Involved)
选项 2(参与最多)
Set up your infrastructure per Apple's guidelinesso that you can send push notifications to Apple's servers. Then, you'll need to build an API so that your iOS device can communicate with your push notification server to initiate the push notification request to Apple's servers.
按照Apple 的指南设置您的基础设施,以便您可以向 Apple 的服务器发送推送通知。然后,您需要构建一个 API,以便您的 iOS 设备可以与您的推送通知服务器通信,以向 Apple 的服务器发起推送通知请求。
True push notification support is not easy so I would suggest option 1 if it works out for you.
真正的推送通知支持并不容易,因此如果对您有用,我会建议选项 1。
回答by leo
It is also possible to send remote push notifications from Mac OS X or iOS. This can be done with the NWPusherproject on GitHub. It provides OS X and iOS apps to send push notifications manually, or you can use the included library directly.
也可以从 Mac OS X 或 iOS 发送远程推送通知。这可以通过GitHub 上的NWPusher项目完成。它提供 OS X 和 iOS 应用程序来手动发送推送通知,或者您可以直接使用包含的库。
While it is unlikely that you want to use this in a production environment, it is very useful during development.
虽然您不太可能想在生产环境中使用它,但它在开发过程中非常有用。
回答by Angel Sharma
we send push notification by two methods :
我们通过两种方法发送推送通知:
1.) By using .net backened.:- In it, you just create .p12 file. To create .p12 file then follow this link http://www.techfunonline.com/how-to-send-push-notification-using-dot-net-backened.html
1.) 通过使用 .net 支持。:- 在其中,您只需创建 .p12 文件。要创建 .p12 文件,请点击此链接http://www.techfunonline.com/how-to-send-push-notification-using-dot-net-backened.html
2.) Php backened.:- In it, you just create .pem file. To create .pem file then follow this link http://www.techfunonline.com/how-to-create-pem-file-for-push-mail-notification-for-php-backend.html.
2.) 支持 PHP。:- 在其中,您只需创建 .pem 文件。要创建 .pem 文件,请点击此链接http://www.techfunonline.com/how-to-create-pem-file-for-push-mail-notification-for-php-backend.html。