问题描述:

  ionic项目,windows下正常,打包android可正常运行;

  因为需要打包到iPhone (ios 11.0.1)上测试,将代码拿到Mac OS环境下(重新npm install、platform add ios等)测试的时候,

  build ios正常、ionic serve正常,但是打包运行到iPhone上的时候,出现应用crash闪退的问题。

  打开XCode连接设备,调试发现具体的错误信息如下:

  

  工程本身编译是没有问题的,可以编译成功:

问题排查:

  开始怀疑是项目代码的问题,或者使用了不支持ios的插件,但是逐一排查后问题并没有消除;

  后来怀疑是ionic工程本身的原因,于是重新创建ionic工程,在不添加plugins之前,一切OK;

  但是在添加完我需要的Background Mode和Local Notifications之后,问题就出现了。

  所以,问题可以定位到Background Mode或者是Local Notifications身上了。

  中间排查过程不赘述,直接介绍如何解决。

解决办法:

  问题是由于Background Mode插件在ios下的一个bug所致:

  在IOS升级到11版本之后,KeyName由_requiresUserActionForMediaPlayback变更成requiresUserActionForMediaPlayback。

  修改办法如下:

  

  按图所示修改插件代码,并保存。

  注意保存的时候,因为文件权限的问题,需要使用iTerm修改一下文件夹权限,如图:

  重新编译,安装到手机,问题解决,应用可以正常运行:

  并且可以正常测试消息推送:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WKWebViewConfiguration 0x1701bcd20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the k的更多相关文章

  1. Terminating app due to uncaught exception 'NSUnknownKeyException' this class is not key value coding-compliant for the key

     Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > se ...

  2. *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key

    *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > ...

  3. Terminating app due to uncaught exception 'NSUnknownKeyException', reason: xxxx

    出现错误的情景: 使用Swift自定义Cell, 然后将这个Cell在OC中使用, 由于为了能够在OC中使用和使用起来命名比较规范 我在Swift自定义的Cell前加了 @objc(DSProduct ...

  4. 在使用可变数组过程中遇到*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'问题

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFD ...

  5. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

    报错: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlace ...

  6. iOS Terminating app due to uncaught exception &#39;NSInternalInconsistencyException&#39;, reason: &#39;unable to

    刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', re ...

  7. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbackParameters 0x1d4442e50> setNilValueForKey]: could not set nil as the value for the key rate.'

    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbac ...

  8. Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CALayer: 0x7fda42c66e30> is a part of cycle in its layer tree'

    iOS App里面所有的View构成一个组件树,这个树里面如果有了闭环就会出现这个报错,最常见的你不小在某UIViewController里面写了这样的代码: someView.addSubView( ...

  9. Adding an Exception Breakpoint - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 25 bey

    用如下的方法可以非常方便停留到具体crash的某行代码 Adding an Exception Breakpoint Add an exception breakpoint to your proje ...

随机推荐

  1. IIS发布网站之后,页面图片和js未加载出错

    [IIS相关]mvc做的web发布之后,运行之后界面上的图片和js都没有加载出来.      解决方案:安装IIS的时候需要勾选ASP选项,否则会出现这种情况. 如果项目是用.Netframework ...

  2. ASP.Net Core 2.2 InProcess托管的Bug:unable to open database file

    最近把项目更新到了ASP.Net Core 2.2,发布之后发现在IIS下使用SQLite数据库不行了,报异常说不能打开数据库."unable to open database file&q ...

  3. hdu2829 Lawrence

    题目链接:戳我 朴素DP:\(dp[i][j]=dp[i-1][k]+cost[k+1][j]\) 其中dp[i][j]表示炸第i次的时候,处理到前j个的最小值是多少.cost[i][j]表示的是i, ...

  4. CentOS 7 - 安装Windows字体!

    1,安装cabextract: 下载地址:http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el7/en/x86_64/rpmforge/RPMS/cabe ...

  5. Mac OS 10.12 - ”ln: /usr/bin/tclsh: Operation not permitted“错误的解决方法!!

    我在对"/usr/bin/"进行创建链接时候,出现错误:”ln: /usr/bin/tclsh: Operation not permitted“,这个错误的原因是Rootless ...

  6. Statement与PreparedStatement区别

    1.性能区别 Statement statement = conn.createStatement(); PreparedStatement preStatement = conn.prepareSt ...

  7. Topological Sor-207. Course Schedule

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  8. Elasticsearch-搜索推荐

    对于es中搜索推荐的功能的实现: 1.使用match_phrase_prefix来实现search-time搜索推荐,原理根match_phrase类似,唯一的区别是把最后一个term作为前缀去搜索, ...

  9. SAX,功能强大的 API

    https://www.ibm.com/developerworks/cn/xml/x-saxapi/ SAX,功能强大的 API 在摘自 XML by Example 的本篇预览中比较了 DOM 和 ...

  10. [Swift实际操作]七、常见概念-(3)尺寸CGSize的使用详解

    本文将为你演示CGSize的使用 首先导入需要使用到的两个框架 import UIKit import QuartzCore 定义一个尺寸对象,尺寸对象包含宽度和和高度两个参数.从右侧的结果可以看出, ...