ios - iOS模拟器崩溃
问题描述
一旦我单击 Flutter ios 模拟器右上角的位置按钮,该应用程序就会自动关闭。
设备:iOS 模拟器(iPhone 11 Pro)。
这是终端上显示的内容。
Lost connection to device.
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e6aefe __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff515339b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e6ad3c +[NSException raise:format:] + 188
3 location 0x000000010384f88a -[LocationPlugin requestPermission] + 426
4 location 0x000000010384ef18 -[LocationPlugin handleMethodCall:result:] + 2072
5 Flutter 0x0000000101332b1f __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
6 Flutter 0x00000001012c1762 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMess<…>
解决方案
崩溃说[LocationPlugin requestPermission]
,发生这种情况是因为您没有将位置权限添加到 info.plist。
要解决这个问题,您需要将位置权限添加到您的 info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>When in use permissions</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>always permissions</string>
<key>NSLocationAlwaysAndWhenInUsageDescription</key>
<string>Always and in usage permissions</string>
推荐阅读
- jquery - 将 .text() 分成变量之间的新行
- python - 在 python 中使用 groupby 计算
- javascript - node.js socket.io 服务器长延迟
- python - python中的gsutil cp通过os.system
- python - 移动特定字符串 pandas df
- sql - Oracle,将持续时间多行拆分为一小时
- c++ - C++ 编译大型结构时内存使用过多
- bash - 如何在子进程失败时替换 BASH 微调器
- r - 我正在运行一个微生物预测功能分析脚本并出现这个奇怪的错误
- python - Python (FileNotFoundError: [WinError 3])