Send push notification from ios app

2019-01-19 08:59发布

问题:

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)

I've seen some exemple of php web site to do this, buy nothing to be able to do this directly from ios.

Any good exemple for me?

Thanks, and have a nice day!

回答1:

Are you needing to send notifications to the iOS device that is currently running your app? If so, you should look into local notifications.

If you're actually wanting to send push notifications to other iOS devices from your iOS device, you basically have two options

Option 1 (Easiest)

Use a service like Parse or Urban Airship to 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.

Option 2 (Most Involved)

Set up your infrastructure per Apple's guidelines so 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.

True push notification support is not easy so I would suggest option 1 if it works out for you.



回答2:

It is also possible to send remote push notifications from Mac OS X or iOS. This can be done with the NWPusher project on GitHub. It provides OS X and iOS apps to send push notifications manually, or you can use the included library directly.

While it is unlikely that you want to use this in a production environment, it is very useful during development.



回答3:

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

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.