惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - 醒着/☆☆

移动硬盘删除不了东西 updata(dt:number)的常用用法 关键字 堆栈实现四则混合运算 在线资源 JS相比TS的缺点(或TS的优点) Vscode的JS debug环境 常见的代码片段 Cocos Creator-TypeScript与JS快速过渡 GooglePlay FB相关 上传速度慢 CocosCreator与Laya2.0区别 LayaBox 常用技巧 CSV的规范与使用 Laya2.0的转变 TypeScript: this bind 和 回调的正确用法 常用资源 意外发现一个具有名称 的外部可见定义
Laya for H5 之Bug追踪
醒着/☆☆ · 2019-01-21 · via 博客园 - 醒着/☆☆

Laya For H5之Bug追踪

H5游戏一旦上线后,如何跟踪用户的崩溃日志呢?现在有很多第三方的工具,比如fundebug,其sdk接入简单,只需寥寥几行代码就可以追踪h5游戏的崩溃日志,bug日志以邮件的形势发送给注册的邮箱,但是其试用周期短,不适合个人开发者。

其实h5前端从获取到崩溃Error到给指定邮箱发送日志,难点在于自动的 给指定邮箱发邮件,因为这涉及到账户安全相关的事宜,而更多的时候纯JS也只是弹出个发送邮件的mail对话框,发送那一下,还是需要你手动的点一下的。

集成步骤

额,无法依赖纯前端来搞定的,我们也是依赖第三方,推荐使用EmailJS这个第三方的SDK.

集成的步骤很简单(企业用户 付费用户可以散了)

  1. 注册EmailJS账号,个人用户就足够了

  2. 登录后,进入账户页面

  3. 设置serviceID
    3.1点击左侧的Email service: 然后点击 Add new Service
    3.2从个人邮箱里选择适合你的
    3.3创建完毕后就会看到你的serviceID
    file-list

  4. 创建邮件模板,{{msg}} {{{ html }}},

模板里使用双{} 或3个{}来作为替换元素
{{}}会转义 如{{userName}} 会加粗,{{{}}}则不会转义

  1. 记录下自己的User ID
    file-list
  2. 集成代码
    <script type="text/javascript" src="https://cdn.emailjs.com/sdk/2.3.2/email.min.js"></script>
    <script type="text/javascript">
        (function () {
            emailjs.init("user_ckIiwXXXXXXXXXXXX");
            var templateParams = {
                    gameName: 'fish-big',//EmailJS管理页面的模板里设置的{{{gameName}}}
                    error: 'Check this out!'//EmailJS管理页面的模板里设置的{{{error}}
    

}; emailjs.send("Your ServiceID","Your TemplateID",templateParams,"user_ckIiwXXXXXXXXXXXX
"); })();
```

好 打完收工,一套bug收集报警就成功的接完了,欣喜之余 还不g快去你的邮箱里查看下崩溃日志,然后开启你的bug之旅。改bug-->解决bug-->再次上传新版本--->再次等待邮件报警 --> .... .....