iOS extracts: Handling Terminations

extracts from 《Programming the iPhone User Experience》


Handling Terminations

Developers should be careful to spend as much time focusing on their exit processesas on their launch processes. The ideal cooperative model, when applied to an appli-cation, would result in a very symmetrical curve where launch and termination are shortand engagement is immediate.

The way in which you terminate your application will probably depend on the state ofthe application and its resources. Obvious goals such as committing all pending trans-actions and freeing used memory are important, but what about preparing for the nextlaunch? Should you cache the whole screen? If so, should you go beyond the clippedarea that is visually present in order to provide for a scrollable placeholder in the future?What will your users expect? Is the nature of your application such that state persistencematters? Will the criteria depend on the frequency between launches? What if the userwaits a month to relaunch your application? What if the wait is five seconds?

The overarching goal is to make opening and closing as painless as possible and tofollow good UX and anticipate the expectations of your users.

Here are some guidelines for streamlining terminations:

  • Perform as few IO tasks as possible. Saving locally will be safer than saving over anetwork.

  • If saving over a network, provide an internal timeout that invalidates your requestand closes the application.

  • Don’t save all persistence tasks until the termination call. Perform database orfilesystem writes when they are relevant instead of caching for one big save. Thereis a balance to find here, but if you consider event-based writes in your design, youcan make informed decisions.

  • Stop any non-critical, expensive operations instead of letting them finish. If yourmain event loop is blocked, your application cannot terminate smoothly. 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值