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

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
浏览: 1450 次
点击打开新窗口浏览全图

Tags: apns, apple

关于APNS的一件挫事

APNS 这玩意啊。关于它曾经转载过N篇文章:

不过自己在實際使用中,也還是遇到了問題。

在測試的時候,我連接apns服務器時,發一條推送就斷開,導致我發送上萬條消息的時候需要幾個小時。我就納悶了,如果大家都這樣,那豈不是那些大網站都要崩潰?這時候,有兩位朋友告訴我,不要斷開,用長鏈接。。。於是乎我重改了代碼,然後就看到消息發送的時候刷刷刷的就出去了。心裏還是非常開心的。

但偶爾還是會有發送失敗的情況出現,所以我做了一點處理,如果取回來的代碼不正確,我會一直重發,直到正確。當然,每次發完後,用usleep,休息了10ms,避免數據過度發送。當然每1000條推送後,我會斷開一下鏈接,再重新鏈接。以防萬一

說白了,還是糾結。

Tags: apns

发邮件让MAC自动休眠

在威鋒網上看到這個主題 後,立馬嘗試了一下。果然不同凡響啊

其實說白了就一句話:tell application "System Events" to sleep
但就這麼一句話,即做了很多事情,看這句話多簡單啊。就是傳說中的自然語言。。告訴程序『系統事件』睡眠。輕輕鬆鬆。。。。。

原文在這裏:http://bbs.weiphone.com/read-htm-tid-4576786.html
因為有圖有文字,我為了方便就說個簡單的吧:
1、啟動"apple script編輯器"(在實用工具中),將剛才上面的那段:tell application "System Events" to sleep輸入進去並保存。
2、打開mail,在偏好設置中,點擊:規則選項卡,然後新增一個規則
3、(我這是偷懶的作法),允許任何一個郵箱收麼的郵件主題為:sleep,不是包含,而是等於。如果為了放心一點,也可以設置一下發件人,這樣會更安全一點
4、上面選好後,下面:就執行下列操作:選擇運行apple script,選擇你剛才保存的文件。
於是整個事情就這麼完成 了。多輕鬆啊。。。。。

最後,放上apple script的教程:applescript 简明基础教程.pdf

Tags: 休眠, apple script

QQ浏览器FOR MAC

在mac下面浏览器有很多种,我常用的还是firefox,毕竟firebug是那样的好用。。。我的大部分密码也都存在上面。同步功能也是非常的爽。嗯。还有read it later插件。还有。。。。太多了

好吧,標題是說qq瀏覽器FOR mac,我為什麼會說這個軟件,我不是喜歡firefox的嗎?其實從界面上來說,我還真不是特別喜歡QQ瀏覽器,中規中矩的,真的不是特別爽。沒有fast dial(可以定義很多格式,而不是只有9格)。不過我還是要推薦它了,可能只是因為他的說明中的一句話:(為了有證據,所以我是截圖)
大小: 66.65 K
尺寸: 500 x 81
浏览: 1765 次
点击打开新窗口浏览全图
只要這一句,就夠讓我使用它了。
如果你在使用mac,你也可以嘗試一下:http://browser.qq.com/mac/index.html

Tags: qq, 浏览器, firefox

金山快盘支持MAC了

昨天在折騰的時候想起了金山快盤,以前依稀記得它說快支持mac了,於是腦袋一熱就上線看了一下。居然看到了一個大蘋果。點進去之後發現。果然支持了。

文件並不大,只要2M左右。官方是这么解释的:

1.0build 20120619RC2更新日志

  • 1、支持局域网同步加速
  • 2、增加文件大于300M文件无法上传的提醒
  • 3、修正下载文件修改时间设置不正确的bug
  • 4、修正多处会导致崩溃的bug

嗯,我已經安裝好了。不過偶爾還是會有文件下載不下來的情況,但這個畢竟我是唯一用的時間最長的國內的同步軟件。

雖然不喜歡金山殺毒軟件,但其他的一些軟件我還是喜歡的。比如我最喜歡的WPS。快盤是和WPS整合的很好的一個軟件。所以我還是會推薦它給各位用(事實上我機器上裝了:dropbox和google driver,但我一直用的卻仍然是這個快盤)

趕緊的:http://www.kuaipan.cn/download_mac.htm

Tags: 金山快盘