Flutter Run-与设备的连接断开(Simulator iPhone 11 Pro Max)

时间:2019-10-15 22:39:53

标签: flutter simulator

每次我打算在IOS模拟器上运行一个项目时,都会显示一条消息“与设备的连接断开”。以前工作正常,我不记得确切地以某种方式干扰Xcode之类的东西。扑扑医生一切都还好...

我收到的报告是:

Mariuss-MacBook-Pro:my_repository-15.10 mariuspruna$ flutter run -d D79DA193-4A54-4D3F-B029-E42F046EEFAF
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...                                                  

 ├─Assembling Flutter resources...                          13.8s
 └─Compiling, linking and signing...                        15.6s
Xcode build done.                                           34.2s
*** First throw call stack:                                             
(                                                                       
        0   CoreFoundation                      0x00007fff23b98bde __exceptionPreprocess + 350
        1   libobjc.A.dylib                     0x00007fff503b5b20 objc_exception_throw + 48
        2   CoreFoundation                      0x00007fff23b98958 +[NSException raise:format:arguments:] + 88
        3   Foundation                          0x00007fff255eb6f5 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
        4   UIKitCore                           0x00007fff47163f36 -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:] + 255
        5   UIKitCore                           0x00007fff471643d9 -[UIApplication statusBar] + 24
        6   Foundation                     <…>                          
Lost connection to device.                                              
Syncing files to device iPhone 11 Pro Max...                            

Mariuss-MacBook-Pro:my_repository-15.10 mariuspruna$ 

谢谢您的建议。

1 个答案:

答案 0 :(得分:0)

对我来说,问题是该应用尝试访问用户地理位置时出现权限错误,但为了首先看到该错误(Android Studio无法提供帮助),我需要使用以下方法将物理iPhone连接到笔记本电脑电缆,然后尝试直接从Xcode在那里部署应用程序。

然后在Xcode上看到错误后。在 Info.plist 文件中,我添加了以下两行来对其进行修复:

<key>NSLocationWhenInUseUsageDescription</key>
<string>This application requires location services to properly work</string>

<key>NSLocationAlwaysUsageDescription</key>
<string>This application requires location services to properly work</string>

然后,该应用程序已成功部署在模拟器和我的真实设备中。