小程序转 App 仅需 7 步

业务背景
如今使用小程序的场景已深入到我们生活中的方方面面,你是否有想过,已开发好的小程序是否不仅能运行在微信平台中,还能运行在我们自己的 app 中呢?是否可以用一个小程序生成一个 app 呢?答案是可以的!七个步骤就能完成!闲话少说,我们马上动手试试吧!
一、准备工作
打开 FinClip 官网https://www.finclip.com/,在开发者中心->资源下载中心,下载并安装 FIDE


二、新增小程序
登录 finclip 官网,在小程序管理->我的小程序新增一个小程序。

比如新增了一个小程序叫 newapp3,那么名称写 newapp3,分类、标签、简介写其他即可。
三、新增合作应用
应用管理->新增合作应用

给这个应用增加一个 Bundle ID

在 newapp3 一栏点击关联小程序,找到刚刚新建的 newapp3,新增关联

四、创建工程
回到桌面,在下载一栏,新增一个空文件夹,命名它为 newapp3。打开 IDE 工具,项目目录选择刚刚创建的 newapp3 文件夹,APP ID 选择 newapp3,然后点击完成。

之后,IDE 会为我们创建默认的 hello world 代码。我们不妨以这个 hello world 作为我们生成 app 的示例。
五、将小程序提交到云端
1.上传

2.审核
回到 finclip 官网,在小程序管理->我的小程序找到 newapp3->详情->审核版本->新增审核

勾选刚刚上传的首次发布版本,点下一步->下一步->提交

此时,该版本会进入审核的队列。
3.同意审核
我们回到小程序管理->小程序上架审核->详情一栏,点击同意即可同意此次审核。

4.上架
在小程序管理->我的小程序找到 newapp3->详情->审核版本->版本上架->确认上架

此时,hello world 的代码就成功提交到云端拉。
六、获得 App 代码
回到 IDE, 点击生成 App,下一步->下一步。导出目录选择下载,点击完成,生成的 App 代码就导出到下载目录了。

App 生成成功后,打开所在目录。目录里有 iOS 和 android 的代码。我们以 iOS 为例,把 app 运行起来。打开终端,cd 到 finclip_demo/ios/finclip_demo,运行 pod install 来拉取依赖①。

看到这个绿色的字样则代表依赖拉取成功了,那么 finclip_demo 就是完整的代码包了拉~
七、运行
双击打开 finclip_demo.xcworkspace,选择模拟器,然后点击运行


后记
一、更新 app 不需要修改 app 的代码,只需要在小程序中修改代码,然后重复走上文中第五步流程即可。
备注
①需要安装 cocoapod,百度搜索如何安装 cocoapod 即可。
本文首发于凡泰极客博客,作者:胡健辉
评论