V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
hustlzp
V2EX  ›  iDev

[iOS 开发请教] 需要达到的效果是:每天晚上从数据库随机读取一个条目,将条目的内容发出一个 notification,如何做到?

  •  
  •   hustlzp ·
    hustlzp · 2014-10-15 13:20:46 +08:00 · 3399 次点击
    这是一个创建于 3484 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如果用remote notification,那用户没有上网就收不到了?

    iOS菜鸟,请教一下大家。
    17 条回复    2014-10-16 16:28:35 +08:00
    kilinmitai
        1
    kilinmitai  
       2014-10-15 14:14:20 +08:00   ❤️ 1
    首先我不是做ios的,只是项目中接触过,不一定对。
    你google下local notification看看是不是你要的
    hustlzp
        2
    hustlzp  
    OP
       2014-10-15 14:51:38 +08:00
    @kilinmitai 谢谢。
    HamGuy
        3
    HamGuy  
       2014-10-15 15:59:58 +08:00   ❤️ 1
    使用计划任务,设定触发时间,就像闹钟一样
    txx
        4
    txx  
       2014-10-15 16:17:10 +08:00   ❤️ 1
    主要思想就是 local notification...

    但如果我沒記錯的話 這貨只支持 64 個...那麼可以配合 background fetch,讓notification 數 維持在 64...
    hustlzp
        5
    hustlzp  
    OP
       2014-10-15 16:31:40 +08:00
    @txx 谢谢,我去看看background fetch。
    Milker90
        6
    Milker90  
       2014-10-15 16:32:27 +08:00   ❤️ 1
    iOS通知通常有两种:
    远程通知,即走苹果的APNs,这种必须得用户手机连上网才可以收到通知;
    本地通知,由系统自己本地通知队列维护,本地通知可以设置触发时间,不需要走网络;

    如果你的数据在后台,又要走APNs是肯定要网的。
    hustlzp
        7
    hustlzp  
    OP
       2014-10-15 16:34:42 +08:00
    @Milker90 数据本地也有一份,在SQLite中。

    看来需要每天运行后台任务,取一条数据,然后触发local notification。
    Milker90
        8
    Milker90  
       2014-10-15 16:40:50 +08:00
    @hustlzp 现在的手机没有网络的情况比较少,智能手机没网就废了 ^_^,数据放在后台你的操作性更灵活些;用本地通知相对来说省事些;各有利弊吧
    hustlzp
        9
    hustlzp  
    OP
       2014-10-15 16:42:32 +08:00
    @Milker90 恩恩,确实啊。我先用remote notification试试~

    感谢。
    satanwoo
        10
    satanwoo  
       2014-10-15 22:14:53 +08:00
    @txx 菜鸟顺便求问一句,background fetch的触发时机怎么控制啊,按照文档是不定时间的不定时长,如果要比较精确的控制在一个时间范围内触发只能使用remote了嘛?
    pH
        11
    pH  
       2014-10-15 23:04:24 +08:00
    hust -0- 再加上这个头像。是10级的么
    txx
        12
    txx  
       2014-10-16 02:31:12 +08:00   ❤️ 1
    @satanwoo 精確控制做不到...但基本上每天都會run一次 時間看系統娘什麼時候開心.....
    hustlzp
        13
    hustlzp  
    OP
       2014-10-16 08:14:57 +08:00
    @pH 哦,老图了...是08级的。
    pH
        14
    pH  
       2014-10-16 10:27:36 +08:00
    @hustlzp 学长啥专业,计算机,软件?现在在做iOS开发么
    hustlzp
        15
    hustlzp  
    OP
       2014-10-16 10:52:14 +08:00
    @pH 哦,本科和研究生都是光电,明年毕业,找了个Node.js的上海那边的工作。
    hustlzp
        16
    hustlzp  
    OP
       2014-10-16 10:52:24 +08:00
    @pH iOS是业余折腾下。
    zichen0422
        17
    zichen0422  
       2014-10-16 16:28:35 +08:00
    @txx 学习了.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3426 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 10:49 · PVG 18:49 · LAX 03:49 · JFK 06:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.