google_maps_flutter 在 ios 设备上崩溃,并出现错误“-[__NSCFString objectForKey:]:无法识别的选择器发送到实例 0x2808f4380”

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

我正在运行 google_maps_flutter 2.1.0 和 flutter 2.10.3。打开地图时,应用程序崩溃并显示以下错误日志。谁能指出问题到底出在哪里。 位置访问权限也已正确授予。不久前,当 flutter 版本为 2.8.0 时,它就可以工作了。

-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x2808f4380
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x2808f4380'
*** First throw call stack:
(0x181955d3c 0x198ccf6a8 0x181a25768 0x1818eff6c 0x1818ef1dc 0x100571b80 0x1816221a8 0x1815c3474 0x100571b18 0x1005724e8 0x1004631b8 0x100461514 0x100460778 0x10045f43c 0x10045e410 0x10044af9c 0x100413bac 0x100412f30 0x100412d78 0x100412b58 0x100acfb10 0x100acf948 0x103f0eb6c 0x10440275c 0x103f3bc98 0x1042c9b54 0x1041f1160 0x1041f4ec4 0x18196a06c 0x1818f43d8 0x1818ef06c 0x1818cef44 0x1818e1e1c 0x1a1c609a0 0x184115b90 0x183eab16c 0x100401de4 0x101918250)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001bba5d9e8 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1bba5d9e8 <+8>:  b.lo   0x1bba5da04               ; <+36>
    0x1bba5d9ec <+12>: stp    x29, x30, [sp, #-0x10]!
    0x1bba5d9f0 <+16>: mov    x29, sp
    0x1bba5d9f4 <+20>: bl     0x1bba59670               ; cerror_nocancel
 
ios flutter dart google-maps google-maps-flutter
4个回答
2
投票

我通过在

AppDelegate.swift

中添加以下行解决了这个问题

GMSServices.setMetalRendererEnabled(true)

这必须在任何 GMSServices 调用之前调用,对我来说只是在

application()
函数开始时,在
GeneratedPluginRegistrant.register(with: self)

之前调用

0
投票

我在这里解决了这个问题,你可以看到它 https://github.com/flutter/flutter/issues/102204#issuecomment-1103795753


0
投票

遇到此问题,通过在 info.plist 文件中添加 NSAppTransportSecurity 密钥来修复它。


0
投票

将以下密钥添加到您的 info.plist 文件中

<key>NSAppTransportSecurity</key>
 <dict>
      <key>NSAllowsArbitraryLoads</key>
     <true/>
 </dict>
© www.soinside.com 2019 - 2024. All rights reserved.