简体   繁体   中英

Sending notifications from Mac to iPhone/ iPad/ iPod touch

I currently sell a Mac-only productivity tool that uses visual and audio notifications to remind the user of certain events taking place.

I've started planning the iPhone and iPad versions of that Mac program and would like to be able to provide notification services from the Mac to the iPhone, eg instead of the Mac playing an audio cue, the iPhone could vibrate, etc.

I have so far done very little iPhone development and I'm not really sure how the various push notification services work. Is this easy enough to do? or is a "challenge".

A few more potentially relevant pieces of information:

  • there will be a Dropbox-based sync between the iPhone and the Mac versions, so there is also the possibility of "sharing" a file that would prompt some action

  • it might be acceptable as a first step to not have "background" notifications and require that the iPhone client is running

What authentication issues should I expect to deal with?

You'll need to implement APNs (Apple Push Notification Service) in both your app and your server.

To clarify a few things:

  1. You'll need a server doing those transferring messages job between the user's Mac/PC and their iDevices.
  2. Your server will decide when to push what kind of notification to which user's device.
  3. After that, your server sends a message to Apple's APNs server, which will push that message on your behalf.
  4. It's absolutely OK that your app can be in the background or even closed when the APNs message arrives at the user's device. The user will be guided by the OS to open your app.
  5. If the user has explicitly disabled your app's APNs function in her/his device, or, if the user cancels the APNs alert when it arrives, your app won't be launched if it originally stays in the background or if it hasn't been open yet.
  6. The user will be asked to enable (as you put it, authenticate) your app's APNs function by the OS in her or his device when your app is launched for the first time.

It's not a challenging task for an experienced iOS developer or an experienced PHP developer, since Apple's documents and APIs are pretty straightforward. However, configuration on the server side can be a little tricky.

I believe Stack Overflow already has tons of information on how to enable APNs in iOS apps. All you need to do is be specific in your question and do the search work beforehand.

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM