您的位置:首页 > 移动开发

关于一种移动端门户的设计和IOS APNS的关联

2012-04-24 16:28 274 查看
昨天喝茶,学院派导师聊到一个架构,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"
}
}

切换view的方式:

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. 信息更新要控制在自己手里,否则会导致大量的流量





APNS needs a certificate!
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(信息提供)

开发

创建Development Profiles(开发所需信息概述)

修改Development
Profiles(开发所需信息的概述)

发布

创建Distribution
Profile(发布所需信息的概述)

修改Distribution
Profiles(发布所需信息的概述

授权文件是对设备如iPod Touch、iPad、iPhone的授权,文件内记录的是设备的UDID和程序的App Id,即使被授权的设备可以安装或调试Bundle identifier与授权文件中记录的App Id对应的程序。

开发者帐号在创建授权文件时候会选择App Id,(开发者帐号下App Id中添加,单选)和UDID(开发者帐号下Devices中添加最多100个,多选)

2. 证书可以把private key包含在文件内,也可以选者不包含,
3. mac 工具keychain access

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: