21
Dec
原文链接;作者:John Gruber
本文是《PastryKit》一文的延续,说的是苹果的网页框架,借助它可以开发非常接近原生 iPhone 程序的网页程序。这篇文章让我想起 2 年前本站作者黄继新写的《iPhone 的互联网野心》,当时 SDK 还未发布,使用网页程序开发 iPhone 应用成为了一种流行的说法。
恕我孤陋寡闻,在 Palm Pre 发布时,我曾觉得 WebOS 独到,原来苹果早已有类似的准备。
苹果公司的各种 JavaScript 框架
乔纳森·「豺狼」·雷恩兹(Jonathan “Wolf” Rentzsch,「豺狼」是他的外号)写了一篇非常棒的概述,介绍了苹果公司内不同团队使用的 JavaScript 框架。有些是公开的,有些则不为人知,例如 PastryKit。它们之间有所重叠。特别是其中的一些框架对 Cocoa 的模仿惟妙惟肖,不仅在 MVC,也深及内里,例如类的名称。(我没有听说过「Gianduia」,但它似乎被藏得很深。苹果的在线零售团队把它用于「天才吧预约系统」之类的事务上。)
但 PastryKit 是唯一针对构建原生风格 iPhone 用户界面的框架。其他框架中类似 PastryKit 的是 TuneKit,这款目前公开的框架用于制作 iTunes LP 和 iTunes Extras 内容包。PastryKit 和 TuneKit 有 40% 的代码相同。(如果不计类名称的前缀:「PK」和「TK」的不同)本站读者格雷格·萨蒂特思盖(Greg Sadetsky)通过电子邮件传来了下面的对比,他通过美化器将代码去最小化。首先是 PastryKit:
const PKTransitionDefaults = {duration: 0.5, delay: 0,removesTargetUponCompletion: false,revertsToOriginalValues: false};const PKTransitionStyles = ["-webkit-transition-property","-webkit-transition-duration","-webkit-transition-timing-function","-webkit-transition-delay","-webkit-transition"];
然后是相似但前缀不同的代码,来自 TunesKit:
const TKTransitionDefaults = {duration: 0.5, delay: 0,removesTargetUponCompletion: false,revertsToOriginalValues: false};const TKTransitionStyles = ["-webkit-transition-property","-webkit-transition-duration","-webkit-transition-timing-function","-webkit-transition-delay","-webkit-transition"];
诸如此类。PastryKit 和 TuneKit 若不是兄弟项目,就是出自同一个人的作品。(另外,丹尼尔·狄杰(Daniel Dilger)九月份在《Wall-E》的 iTunes Extras 包中发现了「PastryKit」的字眼。
iDisk 帮助
一些读者来信指出,iDisk 软件的帮助页面也采用了 PastryKit。如果你通过软件商店安装了 iDisk 程序,可以通过点击「Setting」→「iDisk Help」查看。这个界面看起来同程序的其他部分相似,但一些明显的迹象表明这是一个运行在全屏幕网页模式下的 PastryKit 框架。(例如点击状态栏不会滚动到顶部)
PasrtyKit 是 SDK 还未发布以前的遗迹吗?
我所看到的一个常见问题是(例如,在黑客新闻的这个主题中):PastryKit 是否是「网页程序是创建 iPhone 软件的绝佳解决方案」时代的遗迹?
首先,iPhone 一直有一个用户指引。而我记得,虽然这份指引的操作体验基本上类似原生程序,但是在 iPhone OS 3 上的版本要好得多。事实上,如果你将 Safari 中的浏览器版本(User Agent)设置为 MobileSafari 2(而不是 3),接着载入这份用户指引,就能体验到在 iPhone OS 2.0 上的效果,感觉要差得多。没有滚动魔法、在选中内容后不会出现 iPhone 特有的蓝色渐变,等等。此外,PastryKit 还利用了 mobile WebKit 在 iPhone OS 3.0 中才增加的功能。PastryKit是新的。
苹果意在使网页程序同软件商店竞争
最后,有一个问题,苹果在战略上是否会担忧网页程序 API 和相关市场的完善会影响到 软件商店。如果是的话,他们是否担心钱的问题?我想大概不会。我认为不应过于关注苹果从 30% 分成中得到的收益,并且它还在快速增长。但毫无疑问,软件商店的存在是为了销售更多的 iPhone 和 iPod touch,而不是相反。
更大的忧虑可能会是:网页程序是跨平台的。苹果目前使用用户代理检测技术防止在 MobileSafari 之外的浏览器上运行 PastryKit 用户指引程序。但我不认为在技术上有任何的理由使这些程序不能在 Android 或 WebOS 上同样运作良好并看起来相似。字体也许会略有差别,因为这两个平台都没有包含 Helvetica,但其他看上去就和 iPhone 程序差不多。
尖端网页技术的发展从来不会在不同的浏览器出现「仅能工作」的情况,而且 iPhone、Android、WebOS 都是基于相同的 WebKit 渲染核心。而即使需要对每个平台进行微调,工作量肯定远远少于使用 Cocoa Touch、Android 和 Mojo API 开发各自的原生软件。
我希望苹果不去关注这个问题。首先,桌面级网页程序并未影响到麦金塔的需求。如果有的话,随着 Web 取代 Windows 成为最广泛的软件平台,麦金塔已经获得蓬勃发展。我认为,苹果应该好好鼓励跨平台移动网络程序的发展,而这样做不会减少原生 Cocoa Touch 的吸引力,因为网页框架无法开发高性能(特别是游戏)或访问硬件(例如摄像头)的程序。我也认为这对 iPhone 用户和苹果自身都有益处,在严格控制的软件商店[1]之外另设一个无验证要求的网页程序。虽然是人的本性强调了冲突和刺激,但为什么原生 iPhone 程序和 iPhone 网页程序不
2 Comments so far
Leave a comment
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://apple4.us),and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.
- 「@TangchaProject: 字节社创始人李如一在网易应用中心的 iOS app 推荐:http://t.co/JGPLpuiD 」
- Safari 升级到 5.1.7 了。升级后,若系统内的 Flash 没有打最新的补丁就会禁用。另外据说改善了可用内存低时的反应速度。
- 「@TangchaProject:是的,你现在可以把之前购买的唐茶「单行本」书籍免费迁移到字节社( http://t.co/EOpXM0GC )里阅读了。《唐茶单行本迁移指南》: http://t.co/OTyKu4Ag 」
- 这个 DragonDrop 对于喜欢用鼠标拖拽的用户很有用: https://t.co/O8rNnU3C
- iOS 5.1.1 更新已出。 http://t.co/XKgdgTLI
- 「@fool2nd:新项目 Markable (http://t.co/EQTNQxhP) 上线了。Markable 是一个在线 Markdown 编辑器,支持实时预览,自动保存和恢复,保存到 Dropbox,发布到 Tumblr 等。现在是 beta 版本,欢迎尝鲜。」
- 「@lianghai:〈A Closer Look At Font Rendering〉是 Typekit 的〈Type rendering〉系列之后最值得读的字体渲染科普文章,内容细致而全面(还包括 hinting)……: http://t.co/N5IP3Amg」
- 「@Otahr:第一次开发 iOS 应用,根据之前的想法做了一个可以随机文章的的阅读电台。 http://t.co/7tAhao8z 没有目录也没有历史记录,减少选择、去除浮躁心态,让人可以重新耐心的读完一篇好文章。希望大家可以试试看,给点反馈意见 ;)」
- ifanr 拇指资讯小众讨论
- JavaEye 做最棒的软件开发交流社区
- Make Difference 做最专业的苹果视频翻译网
- 嫣部落 没有政治内容的牛博
- 煎蛋 地球上没有新鲜事
友情链接
-
It really a useful idea.I will have a tiral of this idea as soon as possible as have already frustrated by them for a long time.Thank you…
-
composed by sbsbsb0416 learnt some interesting points from this post thanks a lot
-
Comfortably, the article is in reality the greatest on this noteworthy topic. I concur with your conclusions and will thirstily look forw…
-
Rss好久看不到更新,来这里转转。
-
这是苹果三把
-
Cheap Michael Kors is the hotest handbags in 2012. Summer is coming! It is officially here! WAnd I realized that sometimes, it is decent …
-
Сайт о интересных и удивительных фактах, строениях. Мир стиля и дизайна. Д…
-
This website is actually fascinating i'm looking for is there the other examples? however anyway thanks greatly as a result of I found th…
-
您好,请问知乎今年有没有招实习生的计划呢? 我是一名大三学生,对知乎非常感兴趣,希望能有一个…
-
hey accept concern in force drastically attractive for their performance happy. integrated envelope conformation for these inbred habit i…
-
There usually are very couples of individuals who can write not so easy articles that creatively. Keep up the great work!! http://www.mic…
-
I needed to compose you this little bit of note so as to say thank you again with your magnificent tactics you have shown in this case. I…
-
I'm still learning from you, while I'm improving myself. I certainly love reading everything that is posted on your blog.Keep the aarticl…
-
After research a number of of the weblog posts in your web site now, and I truly like your means of blogging. I bookmarked it to my bookm…
-
An fascinating dialogue is value comment. I feel that it is best to write extra on this topic, it may not be a taboo subject however typi…
对iphone挑战:真正跨手机平台的框架:phonegap
http://www.jdon.com/jivejdon/thread/37844
网页程序不能访问硬件————
HTML5已经开始支持访问硬件的API