ionic在ios设备下启动闪退。日志报错:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _requiresUserActionForMediaPlayback.' *** First throw call stack: (0x18358d1b8 0x181fc455c 0x18358ce80 0x183fc18f0 0x100110980 0x1001b0d04 0x1001e4c90 0x1001e4394 0x1001e486c 0x1001e277c 0x1001015e0 0x189442924 0x1894424ec 0x189448c98 0x189446138 0x1894b868c 0x1001e6950 0x1001012fc 0x1894b46a4 0x1896c4a98 0x1896ca808 0x1896df104 0x1896c77ec 0x18516392c 0x185163798 0x185163b40 0x18353ab5c 0x18353a4a4 0x1835380a4 0x1834662b8 0x1894ad7b0 0x1894a8534 0x1001011ec 0x1824495b8) libc++abi.dylib: terminating with uncaught exception of type NSException
这实际上是一个代码错误,解决也很简单。
在 APPBackgroundMode.m 文件里找到 _requiresUserActionForMediaPlayback 方法,修改为requiresUserActionForMediaPlayback 即可。
或者你也可以从github上下载最新的修复版本。
cordova plugin add https://github.com/katzer/cordova-plugin-background-mode --nofetch
网友评论