我试图在Xamarin Forms Apps中启用“ Link All
”。它已在Android中成功完成。但是,对于iOS版本,我遇到了运行时错误。
应用程序刚刚启动并崩溃。
在iOS
→Main.cs
→UIApplication.Main (args, null, "AppDelegate");
我该如何解决?
崩溃日志已附加。
Foundation.MonoTouchException已引发
抛出Objective-C异常。名称:NSInternalInconsistencyException
原因:应用程序窗口应具有根视图
应用程序启动结束时的控制器本机堆栈跟踪:0
核心基金会0x000000010cf3c1bb
exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010dec2735 objc_exception_throw + 48 2 CoreFoundation
0x000000010cf3bf42 + [NSException提高:格式:参数:] + 98 3
基金会0x000000010c0f5877
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194 4
UIKitCore 0x00000001162c217a-[UIApplication
_runWithMainScene:transitionContext:completion:] + 2978 5 UIKitCore 0x0000000115ae04e9 __111-[__ UICanvasLifecycleMonitor_Compatability
_scheduleFirstCommitForScene:transition:firstActivation:completion:] _ block_invoke
+ 866 6 UIKitCore 0x0000000115ae929c + [_ UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 7 UIKitCore 0x0000000115ae0126
-[__ UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233 8 UIKitCore 0x0000000115ae0ae0
-[__ UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085 9 UIKitCore
0x0000000115adecb5 __82-[_ UIApplicationCanvas
_transitionLifecycleStateWithTransitionContext:completion:] _ block_invoke
+ 795 10 UIKitCore 0x0000000115ade95f-[_ UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435 11 UIKitCore 0x0000000115ae3a90
__125-[_ UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] _ block_invoke
+ 584 12 UIKitCore 0x0000000115ae480e _performActionsWithDelayForTransitionContext + 100 13 UIKitCore 0x0000000115ae37ef-[_ UICanvasLifecycleSettingsDiffAction
performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
+ 221 14 UIKitCore 0x0000000115ae893a-[_ UICanvas场景:didUpdateWithDiff:transitionContext:完成:] + 392 15 UIKitCore 0x00000001162c044e
-[UIApplication工作区:didCreateScene:withTransitionContext:完成:] + 515 16
UIKitCore 0x0000000115e64d09
-[UIApplicationSceneClientAgent场景:didInitializeWithEvent:完成:] + 357 17
FrontBoardServices 0x00000001119552da-[FBSSceneImpl
_didCreateWithTransitionContext:completion:] + 448 18 FrontBoardServices 0x0000000111960443
__56- [FBSWorkspace客户端:handleCreateScene:withCompletion:] _ block_invoke_2 + 271 19
FrontBoardServices 0x000000011195fb3a
__40- [FBSWorkspace _performDelegateCallOut:] _ block_invoke + 53 20 libdispatch.dylib 0x000000010f3dc54b
_dispatch_client_callout + 8 21 libdispatch.dylib 0x000000010f3df60b _dispatch_block_invoke_direct + 312 22
FrontBoardServices 0x0000000111994ba8
__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30 23 FrontBoardServices 0x0000000111994860
-[FBSSerialQueue _performNext] + 457 24 FrontBoardServices 0x0000000111994e40-[FBSSerialQueue _performNextFromRunLoopSource] +
45 25 CoreFoundation 0x000000010cea1721
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 26 CoreFoundation 0x000000010cea0f93
__CFRunLoopDoSources0 + 243 27 CoreFoundation 0x000000010ce9b63f __CFRunLoopRun + 1263 28 CoreFoundation
0x000000010ce9ae11 CFRunLoopRunSpecific + 625 29图形服务
0x0000000111bb91dd GSEventRunModal + 62 30 UIKitCore
0x00000001162c381d UIApplicationMain + 140 31 ???
0x000000012cb7629e 0x0 + 5045183134 32 ???
0x000000012cb76033 0x0 + 5045182515
最佳答案
我正在使用Link all assemblies
而不是Link SDK assemblies only
来减小APK / IPA文件的大小。
对于iOS和Android,它减少了约20MB。
对于iOS,我必须在所有[Preserve(AllMembers = true)]
实现中添加dependency service
。现在一切正常。