Flutter IOS调试版本将应用程序安装在真实的设备上,但无法在30秒内初始化dart VM服务器,并且无法运行应用程序并显示错误消息:
Launching lib/main.dart on User's iPad in debug mode...
main.dart:1
Automatically signing iOS for device deployment using specified development team in Xcode project: FQ********
Xcode build done. 25.7s
The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...
(lldb) process interrupt
error: Failed to halt process: Halt timed out. State = running
Error launching application on User's iPad.
Exited
但是当我尝试用Xcode或模拟器安装在设备上时,它构建并工作正常。我尝试了解决方案的link上的stackoverflow与不同的问题,但没有一个是无济于事的,以解决问题.
我已经尝试过iPad Pro 11英寸2020和iPhone 11 Pro使用相同的WIFI网络。我使用的是MacBook M1 Pro 14英寸2021基本型号。我已经在同一个项目中使用真实的的IOS设备一年多了。但是大约一个月前,它开始给我错误。
当我尝试使用真实的设备进行构建时,该应用不会询问本地网络权限或通知权限。我尝试了不同的项目,它有同样的错误。另外,我创建了一个新的flutter项目,依赖项为0,它给了我同样的错误,但在我用XCode运行应用程序两次后,它开始工作。但是当我从第一个遇到问题的项目中添加依赖项后,我开始得到同样的错误。但奇怪的是,当我使用Flutter发布模式时,它可以很好地与任何项目一起工作。(顺便说一下,我已经在前面提到的两个真实的设备上启用了XCode的无线调试。但与调试版本没有区别。)
XCode版本:版本14.3(14E222b)
Podfile:
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
# config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
]
end
end
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Flutter医生罗嗦:
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-MN)
• Flutter version 3.10.1 on channel stable at /Users/gantushig/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3d8effc68 (9 days ago), 2023-05-16 17:59:05 -0700
• Engine revision b4fb11214d
• Dart version 3.0.1
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/gantushig/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E222b
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (3 available)
• Gantushig’s iPad (mobile) • 00008027-000C684A0A08402E • ios • iOS 16.4.1 20E252
• macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.126
[✓] Network resources
• All expected network resources are available.
• No issues found!
Flutter run verbose最后几行:
[ +52 ms] [ 95%] GeneratingApplicationMap
[ +327 ms] [100%] InstallComplete
[ +987 ms] [100%] Installed package build/ios/iphoneos/Runner.app
[ +99 ms] ------ Debug phase ------
[ ] Starting debug of 00008027-000C684A0A08402E (J418AP, iPad Pro 2G (11" Cell), iphoneos, arm64e, 16.4.1, 20E252) a.k.a. 'Gantushig’s iPad' connected
through USB...
[+1026 ms] [ 0%] Looking up developer disk image
[ +27 ms] [ 95%] Developer disk image mounted successfully
[ +23 ms] Symbol Path: /Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols
[ +457 ms] [100%] Connecting to remote debug server
[ ] -------------------------
[ +99 ms] (lldb) command source -s 0 '/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap-lldb-prep-cmds-00008027_000C684A0A08402E'
[ ] Executing commands in '/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap-lldb-prep-cmds-00008027_000C684A0A08402E'.
[ ] (lldb) platform select remote-'ios' --sysroot '/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols'
[ ] Platform: remote-ios
[ ] Connected: no
[ ] Sysroot: /Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols
[ ] SDK Path: "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols"
[ ] (lldb) target create "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos/Runner.app"
[+6149 ms] Current executable set to '/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos/Runner.app' (arm64).
[ ] (lldb) script fruitstrap_device_app="/private/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1/Runner.app"
[ ] (lldb) script fruitstrap_connect_url="connect://127.0.0.1:59678"
[ ] (lldb) script fruitstrap_output_path=""
[ ] (lldb) script fruitstrap_error_path=""
[ ] (lldb) target modules search-paths add /usr "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/usr"
/System "/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/System"
"/private/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1" "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos"
"/var/containers/Bundle/Application/9191066D-06EC-41D9-A945-7BBDAB5CEBA1" "/Users/gantushig/projects/soyohon/soyohon_mobile/build/ios/iphoneos" /Developer
"/Users/gantushig/Library/Developer/Xcode/iOS DeviceSupport/16.4.1 (20E252) arm64e/Symbols/Developer"
[ +34 ms] (lldb) command script import "/tmp/B9863F2D-673A-40A5-9D48-5C384D397A22/fruitstrap_00008027_000C684A0A08402E.py"
[ +3 ms] (lldb) command script add -f fruitstrap_00008027_000C684A0A08402E.connect_command connect
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.run_command run
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.autoexit_command autoexit
[ ] (lldb) command script add -s asynchronous -f fruitstrap_00008027_000C684A0A08402E.safequit_command safequit
[ ] (lldb) connect
[ +32 ms] (lldb) run
[ +198 ms] success
[ ] Application launched on the device. Waiting for Dart VM Service url.
[+30005 ms] The Dart VM Service was not discovered after 30 seconds. This is taking much longer than expected...
[ +8 ms] (lldb) process interrupt
[ ] error: Failed to halt process: Halt timed out. State = running
[+2073 ms] (lldb) Process 2598 exited with status = -1 (0xffffffff) lost connection
[ +3 ms] ios-deploy exited with code 0
[ +6 ms] Installing and launching... (completed in 56.6s)
[ ] Error launching application on Gantushig’s iPad.
[ +2 ms] "flutter run" took 96,019ms.
[ +3 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:757:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
[ +259 ms] ensureAnalyticsSent: 253ms
[ ] Running 1 shutdown hook
[ +3 ms] Shutdown hooks complete
[ ] exiting with code 1
Flutter pubspec yaml文件:
name: flutter_app
description: Social app.
publish_to: 'none'
version: 1.0.0+36
environment:
sdk: '>=3.0.1 <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dio: ^5.0.0
rive: ^0.11.1
provider: ^6.0.2
cookie_jar: ^4.0.2
dio_cookie_manager: ^3.0.0
path_provider: ^2.0.8
flutter_form_builder: ^9.0.0-dev.3
form_builder_validators: ^9.0.0-dev.2
fluttertoast: ^8.0.9
flutter_svg: ^2.0.0+1
get_it: ^7.2.0
another_flushbar: ^1.10.28
flutter_native_splash: ^2.2.9
image_picker: ^0.8.3
image_cropper: ^3.0.0
pinput: ^2.2.7
firebase_core: ^2.4.1
firebase_messaging: ^14.2.1
flutter_local_notifications: ^14.0.0+1
socket_io_client: ^2.0.1
location: ^4.4.0
avatar_glow: ^2.0.2
device_info_plus: ^9.0.0
carousel_slider: ^4.1.1
skeletons: ^0.0.3
hive: ^2.2.3
hive_flutter: ^1.1.0
qr_flutter: ^4.0.0
url_launcher: ^6.1.6
android_intent_plus: ^4.0.0
device_apps: ^2.2.0
cached_network_image: ^3.2.2
external_app_launcher: ^3.1.0
permission_handler: ^10.2.0
flutter_cache_manager: ^3.3.0
water_drop_nav_bar: ^2.2.0+5
connectivity_plus: ^4.0.0
font_awesome_flutter: ^10.3.0
intl: ^0.18.0
freezed_annotation: ^2.2.0
json_annotation: ^4.8.0
collection: ^1.17.0
webview_flutter: ^4.2.0
webview_flutter_android: ^3.7.0
webview_flutter_wkwebview: ^3.4.3
flutter_native_splash:
image: assets/images/logo.png
color: '#FA4251'
android_12:
image: assets/images/android_splash_icon.png
icon_background_color: '#FA4251'
image_dark: assets/images/android_splash_icon.png
icon_background_color_dark: '#FA4251'
dev_dependencies:
flutter_test:
sdk: flutter
freezed: ^2.3.2
flutter_lints: ^2.0.0
hive_generator: ^2.0.0
build_runner: ^2.3.3
json_serializable: ^6.6.1
flutter:
uses-material-design: true
assets:
- assets/rive_models/simple-loader.riv
- assets/rive_models/find_user.riv
- assets/rive_models/new_file.riv
- assets/rive_models/spaceship_pull_refresh.riv
- assets/rive_models/
- assets/images/christmas_logo.png
- assets/images/astrology/
- assets/images/svg/back.svg
- assets/images/svg/icons/shopping-bag.svg
- assets/images/svg/
- assets/images/back_image/
- assets/images/logo.png
- assets/images/membership/
- assets/images/android_splash_icon.png
- assets/images/mission/icons/
- assets/images/mission/
- assets/images/
- assets/gif/
fonts:
- family: Rubik
fonts:
- asset: assets/fonts/Rubik/Rubik-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Rubik/Rubik-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Rubik/Rubik-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Rubik/Rubik-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Rubik/Rubik-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Rubik/Rubik-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Rubik/Rubik-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Rubik/Rubik-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Rubik/Rubik-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Rubik/Rubik-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Rubik/Rubik-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Rubik/Rubik-ExtraBoldItalic.ttf
style: italic
weight: 800
- asset: assets/fonts/Rubik/Rubik-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Rubik/Rubik-BlackItalic.ttf
style: italic
weight: 900
- family: Roboto
fonts:
- asset: assets/fonts/Roboto/Roboto-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Roboto/Roboto-ThinItalic.ttf
style: italic
weight: 100
- asset: assets/fonts/Roboto/Roboto-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Roboto/Roboto-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Roboto/Roboto-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Roboto/Roboto-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Roboto/Roboto-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Roboto/Roboto-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Roboto/Roboto-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Roboto/Roboto-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Roboto/Roboto-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Roboto/Roboto-BlackItalic.ttf
style: italic
weight: 900
- family: Poppins
fonts:
- asset: assets/fonts/Poppins/Poppins-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Poppins/Poppins-ThinItalic.ttf
style: italic
weight: 100
- asset: assets/fonts/Poppins/Poppins-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Poppins/Poppins-ExtraLightItalic.ttf
style: italic
weight: 200
- asset: assets/fonts/Poppins/Poppins-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Poppins/Poppins-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Poppins/Poppins-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Poppins/Poppins-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Poppins/Poppins-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Poppins/Poppins-MediumItalic.ttf
style: italic
weight: 500
- asset: assets/fonts/Poppins/Poppins-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Poppins/Poppins-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Poppins/Poppins-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Poppins/Poppins-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Poppins/Poppins-ExtraBoldItalic.ttf
style: italic
weight: 800
- asset: assets/fonts/Poppins/Poppins-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Poppins/Poppins-Black.ttf
style: italic
weight: 900
- family: Inter
fonts:
- asset: assets/fonts/Inter/Inter-Thin.ttf
style: normal
weight: 100
- asset: assets/fonts/Inter/Inter-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Inter/Inter-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Inter/Inter-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Inter/Inter-Medium.ttf
style: normal
weight: 500
- asset: assets/fonts/Inter/Inter-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Inter/Inter-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Inter/Inter-ExtraBold.ttf
style: normal
weight: 800
- asset: assets/fonts/Inter/Inter-Black.ttf
style: normal
weight: 900
- family: Source Sans Pro
fonts:
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLight.ttf
style: normal
weight: 200
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLightItalic.ttf
style: italic
weight: 200
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf
style: normal
weight: 300
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-LightItalic.ttf
style: italic
weight: 300
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf
style: normal
weight: 400
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Italic.ttf
style: italic
weight: 400
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf
style: normal
weight: 600
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBoldItalic.ttf
style: italic
weight: 600
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf
style: normal
weight: 700
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-BoldItalic.ttf
style: italic
weight: 700
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf
style: normal
weight: 900
- asset: assets/fonts/Source_Sans_Pro/SourceSansPro-BlackItalic.ttf
style: italic
weight: 900
应该没问题我真的需要启用这个功能,因为用真实的设备进行测试会更方便。
1条答案
按热度按时间bjg7j2ky1#
确保Flutter和Dart SDK版本是最新的:将Flutter和Dart更新到最新的稳定版本。可以使用以下命令:Flutter升级Flutter医生
重置iOS开发证书和配置文件:尝试按照以下步骤重置您的iOS开发证书和配置文件:
在Mac上打开Keychain Access应用。在“钥匙串访问”菜单中,选择“证书助手”,然后选择“重置证书...”,按照提示重置证书。在Xcode中,打开Preferences并导航到“Accounts”选项卡。删除您的Apple ID帐户,然后重新添加。清理并重新生成项目。重新启动iOS设备和开发机器:有时,重新启动iOS设备和开发机器可以解决连接问题并确保重新开始。
检查网络连接:确保您的iOS设备和开发机器连接到同一个Wi-Fi网络。检查是否存在任何可能阻止连接的防火墙或网络配置问题。
检查iOS设备日志:将iOS设备连接到Mac并打开“控制台”应用程序。过滤设备的日志并检查与应用或Dart VM相关的任何错误消息。
尝试不同的USB电缆和端口:在某些情况下,使用不同的USB电缆或连接到开发计算机上的不同USB端口可以帮助与iOS设备建立稳定的连接。
检查冲突软件:请确保您的开发机器上没有运行任何可能干扰与iOS设备连接的软件。例如,虚拟化软件或VPN可能会导致冲突。
检查Xcode配置:验证Xcode项目设置是否正确,包括团队和签名设置。在Xcode中打开您的项目,转到“Signing & Capabilities”选项卡,并确保选择了正确的团队和配置文件。
尝试一个干净的构建:通过执行以下命令运行Flutter项目的干净构建:
flutter clean flutter build ios
在不同的iOS设备上进行测试:如果可能,请尝试在其他iOS设备上运行该应用,以查看问题是否特定于特定设备。
如果上述解决方案都不起作用,则可以提供有关项目设置的更多详细信息,包括项目结构、正在使用的特定依赖项以及遇到的任何其他日志或错误消息。此信息将有助于进一步诊断此问题。