丢失在混合应用程序框架如Ionic,Cordova, [英] Lost in hybrid app frameworks like Ionic, Cordova,

查看:181
本文介绍了丢失在混合应用程序框架如Ionic,Cordova,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前失去了所有这些混合移动应用程序框架。他们都听起来很棒,但我找不到关于用例和主要区别的任何真实的信息。



有人可以解释他们给我或给我提供巨大的资源,特别是关于用例?



我知道这些:Apache Cordova,Ionic,PhoneGap,Steroids(AppGyver),Supersonic(AppGyver),React Native和新的Microsoft Ace ( http://microsoft.github.io/ace/ )。



免责声明:有可能我完全混合他们,他们没有任何关系,因为我失去了。

解决方案

我已经研究了这个话题至少几年了,并且想要写一个周到的博客帖子总结我学到了,但它似乎没有达到顶部我的优先级列表。


$ b ol>
  • 通过Webview混合

  • 通过交叉编译混合

  • 通过JavaScript Core混合







  • 注意:我确定上面有更好的名称,







    通过Webview进行混合



    通常,这些是上面提到的基于cordova(又名手机差距)的应用,例如 Ionic TouchstoneJS Meteor AppGyver类固醇。事实上,类固醇是建立在离子的顶部,如果我记得正确。这些应用程序试图通过使用标准的基于Web的技术(html,css,javascript)模拟类似native的组件(按钮,列表视图,抽屉布局,选项卡视图等)来解决混合问题。要访问设备本地组件,他们使用一个名为cordova的网桥,它将javascript api暴露给本机组件,如相机,GPS,位置,振动等。这是一个强大的社区,如果您需要访问本机组件, 很可能找到一个cordova插件,将满足您的需求。这些类型的应用程序的挑战是,一直是性能。因为他们在 WebView 中呈现整个应用程序(基本上是没有Chrome的全屏浏览器窗口) ,它只有一个线程来渲染整个页面加上执行任何动画等。最后,因为组件是接近的,但不是很像原生组件,并且因为性能接近,但不像原生性能那么光滑,这些应用程序往往在某个地方在不知名的山谷。



    通过交叉编译的混合



    示例的这些将是 Appcelerator的Titanium Xamarin 。这些应用程序通过将本机apis抽象为通用语言来解决混合问题。对于Titanium,那种语言是JavaScript。对于Xamarin,那种语言是C#。因此,要在Xamarin中编写Android,iOS,Windows和Desktop应用程序,您可以使用其抽象(API)将所有代码写入C#,然后将它们交叉编译为实际的原生应用程序。这些方法有正确的想法,但许多人会说,在实际执行方面,它们缺乏。虽然与Titanium的个人经验,我发现实际上构建一个应用程序是相当痛苦,因为你依赖于他们的抽象。如果他们的抽象层中有一个错误,你就被卡住...直到他们修复它。



    通过JavaScript Core混合



    我知道这只有两个例子,Facebook的React Native Telerik的NativeScript 。这是移动应用程序开发的未来在我看来,如果我是你,这是我会集中我的精力。这两种方法都试图解决混合问题,类似地,在每种情况下,开发人员最终写入JavaScript来创建本地组件,但每个都采用非常不同的方法。 React Native通过RCTBridgeModule将JavaScript翻译为Native,而本地脚本通过 JavaScript虚拟机中的一些巧妙的技巧,可以直接访问原生API 。我还没有使用过NativeScript,所以不知道它是成熟还是性能。我安装了他们的示例应用程序,它感觉有点迟缓我。我认为它最酷的价值主张之一是,它字面上给你100%的原生API访问(令人兴奋!)。我在过去的一年里与React Native广泛合作,我超级的印象深刻。两人仍然很年轻,一定会成熟。



    有用的资源




    I'm currently lost with all these hybrid mobile app frameworks. They all sound awesome, but I can not find any real information about the use cases and main differences.

    Can someone explain them to me or provide me with great ressources, especially about the use cases?

    I know of these ones: Apache Cordova, Ionic, PhoneGap, Steroids (AppGyver), Supersonic (AppGyver), React Native and the new Microsoft Ace (http://microsoft.github.io/ace/).

    Disclaimer: It's possible that I mix them completly up and they don't have anything to do with each other, because I'm so lost.

    解决方案

    I've been researching this very topic for at least a couple years now and have been wanting to write up a thoughtful blog post summarizing what I've learned, but it never seems to reach the top of my priority list. I'll provide a short summary here.

    The Three Classes of Hybrid Apps

    1. Hybrid via Webview
    2. Hybrid via Cross-Compiled
    3. Hybrid via JavaScript Core


    NOTE: I'm sure there's are better names for the above, but this is the best I'm coming up with at the moment.


    Hybrid via Webview

    Typically, these are the cordova (aka phone gap) based apps you mentioned above such as Ionic, TouchstoneJS, Meteor, and AppGyver Steroids. In fact, Steroids is built on top of Ionic if I remember correctly. These apps attempt to solve the hybrid problem by mimicking native-like components (buttons, list views, drawer layouts, tab views, etc) using standard web-based technologies (html, css, javascript). To access the devices native components, they use a bridge called cordova, which exposes a javascript api to native components such as camera, gps, location, vibration, etc. This is a robust community and if you need access to a native component, you're likely to find a cordova plugin that will meet your needs. The challenge for these types of apps is and has always been performance. Because they render the entire app in a WebView (basically a fullscreen browser window without the chrome), it only has a single thread to render the entire page plus execute any animations etc. In the end, because the components are close, but not quite like native components, and because performance is close, but not quite as slick as native performance, these apps tend to fall somewhere in the uncanny valley. They sort of look and feel right, but they never really are.

    Hybrid via Cross-Compiled

    Examples of these would be Appcelerator's Titanium and Xamarin. These apps tackle the hybrid problem by abstracting native apis into a common language. For Titanium, that language is JavaScript. For Xamarin, that language is C#. So to write an Android, iOS, Windows, and Desktop app in Xamarin, you'd write all your code in C# using their abstractions (APIs) then cross compile them into actual native apps. These approaches have the right idea, but many would say they fall short when it comes to actually implementation. Though personal experience with Titanium, I found actually building an app was quite painful because you're dependent on their abstraction. If there's a bug in their abstraction layer, you're stuck... until they fix it.

    Hybrid via JavaScript Core

    There are only two examples of this that I know of, Facebook's React Native and Telerik's NativeScript. This is the future of mobile application development in my opinion, and if I were you, this is where I'd focus my energy. Both of these attempt to solve the hybrid problem similarly in that in each case the developer ultimately writes JavaScript to create native components, but each takes a very different approach. React Native translates your JavaScript to Native through the RCTBridgeModule, whereas Native Script gives you direct access to native apis through some clever trickery in the JavaScript Virtual Machines. I've not worked with NativeScript yet, so don't know how mature or performant it is. I installed their example app and it felt a bit sluggish to me. I think one of it's coolest value propositions is that it literally gives you 100% access to native APIs (mind blowing!). I have worked extensively with React Native this past year and I am super impressed. Both are still very young still and will certainly mature.

    Useful Resources

    这篇关于丢失在混合应用程序框架如Ionic,Cordova,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆