从Mac发送通知到iPhone / iPad / iPod touch [英] Sending notifications from Mac to iPhone/ iPad/ iPod touch

查看:215
本文介绍了从Mac发送通知到iPhone / iPad / iPod touch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前销售的是一款仅限Mac的生产力工具,它使用视觉和音频通知来提醒用户某些事件发生。

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

我已经开始计划iPhone了和Mac版本的Mac程序,并希望能够提供从Mac到iPhone的通知服务,例如而不是Mac播放音频提示,iPhone可能会振动,等等。

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, e.g. instead of the Mac playing an audio cue, the iPhone could vibrate, etc.

到目前为止,我已经完成了很少的iPhone开发,我不确定各种各样的推送通知服务工作。这很容易吗?或者是挑战。

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".

一些可能相关的信息:


  • iPhone和Mac版本之间会有一个基于Dropbox的同步,所以还有可能共享一个会提示某些动作的文件

  • 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

作为没有背景通知并要求iPhone客户端正在运行的第一步可能是可以接受的

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?

推荐答案

您需要实施APN( Apple应用程序和服务器中的Apple推送通知服务。

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

澄清一些事项:


  1. 您需要一台服务器在用户的Mac / PC和他们的iDevices之间进行传输消息。

  2. 您的服务器将决定何时向用户的设备推送何种通知。

  3. 之后,您的服务器向Apple的APNs服务器发送消息,这将代表您推送该消息。

  4. 当APN消息到达用户设备时,您的应用可以在后台甚至关闭,这是绝对可以的。操作系统将指导用户打开您的应用程序。

  5. 如果用户已在其设备中明确禁用了应用程序的APN功能,或者,如果用户在取消APN警报时它到了,你的应用程序如果最初停留在后台或者尚未打开它将不会启动。

  6. 将要求用户启用(如你所说当你的应用程序第一次启动时,操作系统会在你或他的设备上运行你的应用程序的APN功能。

  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.

它不是对于经验丰富的iOS开发人员或经验丰富的PHP开发人员而言,这是一项具有挑战性的任务,因为Apple的文档和API非常简单。但是,服务器端的配置可能有点棘手。

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.

我相信Stack Overflow已经有大量关于如何在iOS应用程序中启用APN的信息。您需要做的只是在您的问题中具体,并事先进行搜索工作。

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.

希望有所帮助。

这篇关于从Mac发送通知到iPhone / iPad / iPod touch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆