昨天喝茶,学院派导师聊到一个架构,PSDL-portal service describe language.主要思想是封装了数据/操作序列/view(甚至view container)
然后这个与此有关的东西APNS:
A push notification is a short message that consists of the device token, a payload, and a few other bits and bytes. The payload is what we are interested in, as that contains the actual data we will be sending around.
Your server should provide the payload as a JSON dictionary. The payload for a simple push message looks like this:
{ "aps": { "alert": "Hello, world!", "sound": "default" } }
There are other items you can add to the “aps” section to configure the notification. For example:
{ "aps": { "alert": { "action-loc-key": "Open", "body": "Hello, world!" }, "badge": 2 } }
Now “alert” is a dictionary of its own. The “action-loc-key” provides an alternative text for the “View” button. The “badge” field contains the number that will be shown on the application icon. This notification will not play a sound.
其实分析一下:json的内容就包含了,终端会使用的view(展现方式),我门提供的数据等内容。看起来其实也蛮好理解的,内容越短越好,apple的规定是超过256不接收的。
APNS的可能问题:
1. 不可信,因为即使notification发送出来,到apple的中心服务器后,未必发送达到客户端
2. 信息更新要控制在自己手里,否则会导致大量的流量
push的内容多要经过ssl签名否则apple server不处理,这个ssl证书只和app dev id唯一相关,保证只有你会给你自己的程序发notification程序端知道provisioning profile:
Development. If your app is running in Debug mode and is signed with the Development provisioning profile (Code Signing Identity is “iPhone Developer”), then your server must be using the Development certificate.
Production. Apps that are distributed as Ad Hoc or on the App Store (when Code Signing Identify is “iPhone Distribution”) must talk to a server that uses the Production certificate. If there is a mismatch between these, push notifications cannot be delivered to your app.
不到最后发布,不要使用iphone distribution:
关于申请证书,有以下几点需要注意的:
1. provisioning portal不是任何browser可以访问的;http://blog.sina.com.cn/s/blog_545b80040100v3n4.html
Provisioning(信息提供)
Open Keychain Access on your Mac (it is in Applications/Utilities) and choose the menu option Request a Certificate from a Certificate Authority….
Go to App IDs in the sidebar and click the New App ID button.
http://blog.sina.com.cn/s/blog_545b80040100v3n4.html