Sending a notification from OS X to iOS

4.3k Views Asked by At

I have a Mac application and an iOS application. I need to display a notification on iOS, coming from the Mac app.

Is there any easier way to do it than using Push Notifications or network sockets (UDP or TCP)? Maybe Apple provides it away?

I need to make sure that the user hears this notification. The application should launch in the background and start playing sound.

4

There are 4 best solutions below

0
On

If they are on the same network you can use bonjour ( https://developer.apple.com/bonjour/index.html ) for communication between mac app and iOS app.

If they are on different network you have to use a server, the server will be connected to both mac app and iOS app via tcp, and you can send msgs via the server. And if the iOS device is locked or app is in background you have to implement push notification for sending data to the iOS app.

2
On

I think the only acceptable solution is to send push notifications via APNS from mac to iOS device due to limitations on app lifetime on iOS. There is nothing hard in implementing APNS, there are lots of ready implementations, like NWPusher - you may copy it to your project and setup the environment - keys, device tokens - and you're done. To transmit tokens from iOS to your mac app, you may use tons of ways. For example, implement simple web-service on mac and send tokens via http/https.

You may also use a ready server-side implementations, like parse.com, to send push notifications.

0
On

There is another option known as BLE .With BLE you can interact between mac and iOS using core bluetooth framework.

When you receive any message from mac to iOS using this framework you can show a local notification and can wake an app, since BLE also works well in background mode.

For mac to act as peripheral there is a good open source project over here.

you can find more information about BLE here.

Hope this helps.

0
On

Not sure of your use case, but using Apple's push notifications to serve notifications for your app seems like a suitable choice. Again, not sure of your use case, but an alternative may be to send a text-message using the Twilio API.