错误:CoreGraphics API 的数值无效(NaN 或非数字) - 可能与 SwiftUI 中的 UITextview 相关

问题描述 投票:0回答:1

当我将鼠标悬停在 swiftUI 应用程序中的文本部分(该应用程序使用 UITextView 可表示)上时,我在模拟器中收到这个奇怪的警告。在实际设备上,这是无法复制的。

Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.

If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE

启用 CG_NUMERICS_SHOW_BACKTRACE 时,我得到此回溯。

2023-06-04 10:21:38.983039+0100 TextViewRepresentable[12699:10411840] [Unknown process name] Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.
2023-06-04 10:21:38.992493+0100 TextViewRepresentable[12699:10411840] [Unknown process name] Backtrace:
  <CGPathMoveToPoint+71>
   <+[UIBezierPath _continuousRoundedRectBezierPath:withRoundedCorners:cornerRadii:segments:smoothPillShapes:]+1636>
    <+[UIBezierPath _continuousRoundedRectBezierPath:withRoundedCorners:cornerRadius:segments:]+170>
     <+[UIBezierPath _roundedRectBezierPath:withRoundedCorners:cornerRadius:segments:legacyCorners:]+337>
      <-[UIScrollViewAccessibility accessibilityPath]+1575>
       <-[NSObject(AXPrivCategory) _accessibilityBaseHitTest:withEvent:]+2879>
        <-[NSObject(AXPrivCategory) _accessibilityHitTest:withEvent:]+92>
         <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+154>
          <-[UIViewAccessibility __accessibilityHitTest:withEvent:]+1675>
           <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+101>
            <__64-[NSObject(AXPrivCategory) _accessibilityBaseHitTest:withEvent:]_block_invoke.243+180>
             <-[NSObject(AXPrivCategory) _accessibilityBaseHitTest:withEvent:]+4038>
              <-[NSObject(AXPrivCategory) _accessibilityHitTest:withEvent:]+92>
               <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+154>
                <-[UIViewAccessibility __accessibilityHitTest:withEvent:]+1675>
                 <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+101>
                  <-[UIViewAccessibility __accessibilityHitTest:withEvent:]+1675>
                   <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+101>
                    <-[UIViewAccessibility __accessibilityHitTest:withEvent:]+1675>
                     <-[UIViewAccessibility _accessibilityHitTest:withEvent:]+101>
                      <-[UIWindowAccessibility _accessibilityHitTest:withEvent:]+138>
                       <_copyElementAtPositionCallback+5184>
                        <___AXXMIGCopyElementAtPosition_block_invoke+79>
                         <_handleNonMainThreadCallback+424>
                          <_AXXMIGCopyElementAtPosition+670>
                           <_XCopyElementAtPosition+521>
                            <mshMIGPerform+1024>
                             <__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__+41>
                              <__CFRunLoopDoSource1+538>
                               <__CFRunLoopRun+2671>
                                <CFRunLoopRunSpecific+560>
                                 <GSEventRunModal+139>
                                  <-[UIApplication _run]+994>
                                   <UIApplicationMain+123>
                                    <__swift_memcpy93_8+12403>
                                     <__swift_memcpy93_8+12076>
                                      <__swift_memcpy195_8+14237>
                                       <$s21TextViewRepresentable0abC3AppV5$mainyyFZ+30>
                                        <main+9>
                                         107c8d384    

任何想法有多么重要,因为它只发生在模拟器上,以及如何解决它?
谢谢

swiftui uitextview
1个回答
0
投票

我是这样解决的;

Info.Plist 添加应用程序传输安全设置并设置值 YES

© www.soinside.com 2019 - 2024. All rights reserved.