当 Ionic 3 应用程序在大于 9.3 的 ios 上运行时,Xcode 给出异常
Posted
技术标签:
【中文标题】当 Ionic 3 应用程序在大于 9.3 的 ios 上运行时,Xcode 给出异常【英文标题】:Xcode is giving exception when Ionic 3 app run on ios greater than 9.3 【发布时间】:2018-05-04 05:38:12 【问题描述】:当 Ionic 3 应用在大于 9.3 的 ios 上运行但 9.3 或更低版本正常时,Xcode 会给出异常,为什么?
给出这个痕迹:
2018-05-04 10:12:51.442622+0500 AfroCoin[3018:45327] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/ApplePro/Library/Developer/CoreSimulator/Devices/13045814-2612-45C9-B223-CFC9C7F84987/data/Containers/Data/Application/5E794874-59EA-4DF6-B824-82B97E52E402/Library/Cookies/io.ionic.afrocoinworldwide.binarycookies
objc[3018]: Class VCWeakObjectHolder is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/Frameworks/ViceroyTrace.framework/ViceroyTrace (0x1299384d0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/AVConference (0x128a64e38). One of the two will be used. Which one is undefined.
2018-05-04 10:13:03.634193+0500 AfroCoin[3018:45327] Apache Cordova native platform version 4.5.3 is starting.
2018-05-04 10:13:03.637288+0500 AfroCoin[3018:45327] Multi-tasking -> Device: YES, App: YES
2018-05-04 10:13:03.777136+0500 AfroCoin[3018:45327] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-05-04 10:13:04.034624+0500 AfroCoin[3018:45327] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WKWebViewConfiguration 0x7fc776d138a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _requiresUserActionForMediaPlayback.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c2bf1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010a69e031 objc_exception_throw + 48
2 CoreFoundation 0x000000010c2bf0b9 -[NSException raise] + 9
3 Foundation 0x000000010a0bfb47 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 AfroCoin 0x000000010926df46 __43+[APPBackgroundMode swizzleWKWebViewEngine]_block_invoke + 358
5 AfroCoin 0x0000000109285667 -[CDVWKWebViewEngine pluginInitialize] + 983
6 AfroCoin 0x00000001092d13ab -[CDVViewController registerPlugin:withClassName:] + 315
7 AfroCoin 0x00000001092d0abc -[CDVViewController newCordovaViewWithFrame:] + 1404
8 AfroCoin 0x00000001092d0fc2 -[CDVViewController createGapView] + 354
9 AfroCoin 0x00000001092ce516 -[CDVViewController viewDidLoad] + 566
10 AfroCoin 0x000000010926c196 -[MainViewController viewDidLoad] + 54
11 UIKit 0x000000010f59b191 -[UIViewController loadViewIfRequired] + 1215
12 UIKit 0x000000010f59b5d4 -[UIViewController view] + 27
13 UIKit 0x000000010f469183 -[UIWindow addRootViewControllerViewIfPossible] + 122
14 UIKit 0x000000010f469894 -[UIWindow _setHidden:forced:] + 294
15 UIKit 0x000000012805a136 -[UIWindowAccessibility _orderFrontWithoutMakingKey] + 86
16 UIKit 0x000000010f47c62c -[UIWindow makeKeyAndVisible] + 42
17 AfroCoin 0x00000001092d2e08 -[CDVAppDelegate application:didFinishLaunchingWithOptions:] + 776
18 AfroCoin 0x000000010926bf17 -[AppDelegate application:didFinishLaunchingWithOptions:] + 199
19 UIKit 0x000000010f3ee75b -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278
20 UIKit 0x000000010f3f01d2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123
21 UIKit 0x000000010f3f562b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
22 UIKit 0x000000010f7b7e4a _111-[__UICanvasLifecycleMonitor_Compatability scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
23 UIKit 0x000000010fb8a909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
24 UIKit 0x000000010f7b7a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
25 UIKit 0x000000010f7b82a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
26 UIKit 0x00000001101294d4 _82-[_UIApplicationCanvas transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
27 UIKit 0x000000011012936e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
28 UIKit 0x000000010fe0d62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
29 UIKit 0x0000000110008387 _performActionsWithDelayForTransitionContext + 100
30 UIKit 0x000000010fe0d4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
31 UIKit 0x000000010fb89fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
32 UIKit 0x000000010f3f3f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
33 UIKit 0x000000010f9c6a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
34 FrontBoardServices 0x00000001184402f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
35 FrontBoardServices 0x0000000118448cfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
36 libdispatch.dylib 0x000000010d5b8848 _dispatch_client_callout + 8
37 libdispatch.dylib 0x000000010d5bde14 _dispatch_block_invoke_direct + 592
38 FrontBoardServices 0x0000000118474470 _FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK_ + 24
39 FrontBoardServices 0x000000011847412e -[FBSSerialQueue _performNext] + 439
40 FrontBoardServices 0x000000011847468e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
41 CoreFoundation 0x000000010c261bb1 _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17
42 CoreFoundation 0x000000010c2464af __CFRunLoopDoSources0 + 271
43 CoreFoundation 0x000000010c245a6f __CFRunLoopRun + 1263
44 CoreFoundation 0x000000010c24530b CFRunLoopRunSpecific + 635
45 GraphicsServices 0x000000010e1eba73 GSEventRunModal + 62
46 UIKit 0x000000010f3f70b7 UIApplicationMain + 159
47 AfroCoin 0x000000010926be31 main + 65
48 libdyld.dylib 0x000000010d635955 start + 1
49 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
【问题讨论】:
【参考方案1】:根据我的经验,您需要将您的cordova
版本更新为cordova
的旧版本。
作为 iOS 9.0 之后不推荐使用的方法,因此您需要从该密钥 (_requiresUserActionForMediaPlayback
) 中删除 _ 或更新您的 cordova cli
更新cordova cmd:
$ sudo npm update -g cordova
通过更新到最新的 Cordova CLI 将解决您的崩溃问题。
有关更多参考,您可以在 GitHub 上找到以下报告的问题:
问题链接:https://github.com/katzer/cordova-plugin-background-mode/issues/264
希望这会有所帮助。
【讨论】:
非常感谢您提供的链接github.com/katzer/cordova-plugin-background-mode/issues/264帮助了我,非常高兴再次感谢 很好,提供的链接可以帮助您,如果它可以工作,请接受这个答案,以便其他人发现它有帮助。 @CodeChanger 先生,我只更新了科尔多瓦版本或从该链接重新安装了整个插件,请告诉我?以上是关于当 Ionic 3 应用程序在大于 9.3 的 ios 上运行时,Xcode 给出异常的主要内容,如果未能解决你的问题,请参考以下文章
ionic 3:在 android fcm.onNotification() 中,当应用程序处于后台时,点击通知时不会调用
WKWebView 视口缩小以适应在 iOS 9.3 上不起作用