手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:apple

apns 二三事

今天要說的還是推送,NND,這個推送這玩意,折騰死人
1、aps中是否只能有badge/alert/sound等參數?
答:不是,這個只是最基本的參數,可以有很多參數,但aps標記需要一定存在,其他參數可以自定義,比如:

JavaScript代码
  1. {  
  2.     "aps" : {  
  3.     },  
  4.     "acme2" : [ 5,  8 ]  
  5. }  

aps参数可以是空,但一定要有,上面这个可不是我杜撰的,这是官方的例子:http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW12

2、aps中的content-available是什么意思
答:这个是有特殊需要的时候才需要用,比如用来后台下载?说实话,我在官方没找到文档,反而在adobe找到一个小的介绍 :
第一个介绍:http://www.adobe.com/devnet/digitalpublishingsuite/articles/dps-push-notification.html

Table 3. Parameters for APNS messages

Property value description
alert <string> The text message to display to the user. No localization arguments are supported.
badge <number> If non-zero, it displays the number on the icon of the application. If zero, no number is displayed.
content-available 0 | 1 Non-zero indicates a Newsstand push message. The receipt of this will wake the viewer to begin a background download. See Notes.
sound "default" Only the default notification sound is supported.
productID <string> Product.

Notes about Newsstand background downloading

  1. Background downloads are limited to once every 24 hours, +/- 1 hour (or so). You can send as many alert messages you like, but only background downloading will be throttled.
  2. Background downloading will only happen over WiFi connections. If the user is on 3G and the push is received, the background download is lost.
  3. A valid subscription via Apple or direct entitlement (CDS, TCS, PCD, Dovetail, or other) must exist.
  4. Only the most recent folio will be background-downloaded. The user must be entitled to this content.
  5. Apple attempts a number of times to deliver the push payload. As such, the actual download may begin a significant amount of time after it was originally sent or scheduled.

用了content-available参数后,下一次接收一定是在24小时后。看上面的notes

还有一个介绍在这里:http://www.viggiosoft.com/blog/blog/2011/10/17/ios-newsstand-tutorial/,这篇博客很详细,还告诉你在APP中怎么设置,内容过长,我就不一一贴出来了。
它这么说:
The push notification message has the same syntax as standard push notifications with the only difference that the payload must contain the content-available key set to 1:

JavaScript代码
  1. {  
  2.   "aps":{  
  3.     "content-available":1,  
  4.         },  
  5.    "device_tokens": ["E9623F5CFDE92B40DA4AA90B97B70428BCD8FFCBA067BE17A6EF5102651E66E9"]  
  6. }  

There is one importation limitation related to the frequency of pushes: to limit the consumption of resources due to background downloading (which, by the way, we’ll happen only if the device is connected to a Wi-Fi network) Newsstand push notifications are coalesced and only one background download is permitted per day. For testing purposes you can remove this limit by setting an appropriate key in the user defaults (do this at startup in your App Delegate)
大小: 96.37 K
尺寸: 251 x 376
浏览: 1445 次
点击打开新窗口浏览全图

Tags: apns, apple

苹果服务器反馈服务

如果供应商试图发送推送通知到一个应用程序,但应用程序已经不存在该设备中了,设备会报告一个信息给苹果推送通知服务器。这种情况经常发生,当用户卸载应用程序后。如果设备报告了尝试传递应用程序推送通知时的失败,APNS需要一些方法来通知供应商,以便它能够避免再次将通知发送到该设备。这样做可以降低不必要的消息开销和提高系统的整体性能。

为此苹果的推送通知服务器包括一个反馈服务,APNS不断更新每个应用程序的失效的设备令牌列表。该设备是识别设备令牌是否由二进制格式的编码的。供应商应定期查询反馈服务来获取他们的应用程序的设备令牌,以鉴别是否还存在(名单)。然后,验证应用程序是不是最近(被识别的设备)重新注册了,否者供应商应停止向这些设备发送通知。

反馈服务可以通过一个二进制接口来访问,和发送推送通知相类似。您可以通过feedback.push.apple.com端口2196访问反馈服务的结果您可以通过feedback.sandbox.push.apple.com端口2196访问沙盒的反馈服务的结果。至于二进制接口与推送通知一样,您必须使用TLS(或SSL)来建立一个安全的通信通道。这些连接所需的SSL证书是同一个是发送通知提供的。要建立一个值得信赖可以供应商的身份,你应该与APNS使用点对点的连接验证时提交此证书。

一旦连接,传输立即开始,你不需要发送任何命令到APN开始读取反馈服务传输过来的数据流,直到没有数据流了。数据是具有以下格式的元组:

5-4 反馈元组的二进制格式

大小: 9.74 K
尺寸: 346 x 92
浏览: 1397 次
点击打开新窗口浏览全图

Timestamp

A timestamp (as a four-byte time_t value) indicating when the APNs determined that the application no longer exists on the device. This value, which is in network order, represents the seconds since 1970, anchored to UTC. 

You should use the timestamp to determine if the application on the device re-registered with your service since the moment the device token was recorded on the feedback service. If it hasn’t, you should cease sending push notifications to the device.  

Token length

The length of the device token as a two-byte integer value in network order. 设备令牌的长度为两个字节的整数值的网络字节序。

Device token

The device token in binary format.

Tags: apple, 反馈

删除BootCamp分区

机器上早就没有windows了,所以bootcamp分区对我来说也就没有了意义,主要是机器刚拿到手的时候,被IT分盘分的太厉害了。一半对一半啊。
所以找资料想删除这个bootcamp分区,或者将它的容量再减少一点。
找了一下资料,发现原来在工具的磁盘管理里就可以直接操作:
进入实用工具-》磁盘管理
点中左侧的硬盘(不是点中分区哦,是点中硬盘),在右侧的TAB中,选择分区,可以进行删除或者调整容量大小。

灰常方便,我是将它删除并且重建了一个50G左右的分区,用来存放我的一些重要文件(比如:软件、我的WEB代码 之类的。),这样以后我要备份也只备份这一个分区就OK了

Tags: apple, bootcamp

转:申请苹果IDP流程

在苹果电脑没有到手先,先将这些信息备份下来,嗯,还有android的申请流程,过两天也会复制和转贴过来,免得以后真想找的时候找不到(听说android用国内的信用卡还不能申请?纠结中)
原文来自:http://blog.sina.com.cn/s/blog_53e2ac4d0100o06i.html
内容如下:

第一:IDP的申请

1.先在iPhone DevCenter上注册成为iphone developer
http://developer.apple.com/devcenter/ios/index.action

2.加入 iPhone开发程序项目iPhone Developer Program Apply Now
http://developer.apple.com/programs/start/standard/

3.你会得到一个PDF,打印出来,然后填写
填写IDP billing 表单的时候,注意,除开签名要手写(可以中文),其他的一定要全英文,不行就拼音。必须非常注意的是,billing address是你信用卡的账单地址,一定要和当时申请信用卡时的地址一致。

4,填好后发传真到指定号码,发完后给chinadev@asia.apple.com回一封信,告诉他们你已经传真过了。
您好:我已将表格填好并传真至+1 (408) 862-7602,还请劳烦贵公司工作人员帮忙与Billing 团队确认是否收到了我的传真。不胜感激。
最后查看信箱会有一自动回复的信件。

 

题外话:我公司的传真机不能发到美国,所以我用外国人的免费网站发了。

http://www.gotfreefax.com/

他说:Send Free Fax Online to the U.S. and Canada!

把你的传真件扫描一下,反正最后变成PDF格式。

网站上,填写各种信息,你的邮箱要写对,苹果号码4088627602,不要加1。

然后就到邮箱去,按照步骤操作,5分钟就会提示成功。

 

接下来就是等,苹果回复了,希望我的资料填写正确,一切顺利。

---------------------------
Over,现在developer.apple.com的用户登录好象也要翻墙了,真TMD纠结,其实以前developer.android.com也是要翻墙的。

Tags: apple, idp

杂记

一点小记录吧
第一:jQuery 升级到1.5.1了,前两天在群里的时候还有人在说,1.5不支持IE9,因为在使用的时候居然出错了。报错信息居然是document.getElementsByTagName,但是直接写这样的document.getE....是正常的。所以,这明显就是1.5的BUG。

当然这里不是说这个,这里是一篇翻译,http://www.cnblogs.com/sanshi/archive/2011/02/25/1964441.html。我觉得主要内容是这一段:

jQuery 目前把 IE9作为一个重要的浏览器来支持。所有已知的BUG都已经得到修复或者已经提交给IE的开发团队以便在最终版本中得到解决。(All known bugs have been fixed and/or been reported to the IE team for resolution in the final release.

三个新的参数被添加到jQuery.ajax()

isLocal: 允许当前的执行环境被识别为“local(例如文件系统)jQuery默认情况下是不会识别这种环境。如下的协议被识别为本地环境:file, *-entension, widget. 如果需要修改isLocal,推荐使用$.ajaxSetup()方法来修改。

mimeType: 可以用来覆盖XHRmime type.

xhrFields: 一个可以添加到原生XHR对象上的键值对(fieldName-fieldValue)。比如,你可以在跨域调用中设置withCredentialstrue

第二:第二件嘛就是果粉比较开心的事了,那就是前两天刚刚苹果刚刚更新了商店里商品的信息,所有的mac pro现在都更新CPU为i5了,而且价格没变。这实在太让人激动开心了。黑黑,看来我去年没有买成mac pro也是属于塞翁失马焉知非福吧。

第三:yahoo的邮箱更新了。其实这并不算是什么 新闻吧。不过自从我用yahoo的邮箱以来,这是第三次更新了。虽然每一次打开邮箱都感觉比较慢(应该是邮箱服务器在国外的关系吧),但是我想说的是用户体验。用过很多WEB邮箱,几乎到现在都没有更新过,几年前什么 界面现在还是。。。当然QQ邮箱变化是较大的,以前最喜欢用网易的邮箱,SINA以前是最烂的,现在好很多。139邮箱原来也不行,现在也好很多了。gmail的变化也比较小,只是一些小功能的更新,只是这些小功能的更新会让用户使用起来更流畅。

第四:Google JavaScript Style Guide。这个嘛,啥时候有空的时候翻译翻译吧。还是算比较好的,虽然只是google的js style,但是对我们开发人员来说也可以学习学习。原文在这里http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Tips_and_Tricks

Tags: jquery, apple

Records:912