在尝试了几件事但都没有成功之后,我请求帮助。
1-问题
即使在iOS模拟器、Android模拟器和物理设备上一切正常,我也无法在物理iPhone上部署我的flutter应用程序(自动签名(。。。
在"Android studio"上构建时出错;运行":(编辑(
> Launching lib/main.dart on iPhone in debug mode... Legacy build system
> detected, removing
> /Users/truc/StudioProjects/truc/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
> Automatically signing iOS for device deployment using specified
> development team in Xcode project: VU929CKC2Q Running Xcode build...
> Xcode build done.
> 59,3s Failed to build iOS app Error output from Xcode build: ↳
> 2021-11-29 13:07:45.010 xcodebuild[92092:2943731] DVTAssertions: Warning in
> /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-18108/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
> Details: (null) deviceType from 00008030-0008252C0185402E was NULL when -platform called.
> Object: <DTDKMobileDeviceToken: 0x7fafa1b7f0c0>
> Method: -platform
> Thread: <NSThread: 0x7faf9ef4f360>{number = 3, name = (null)}
> Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
> ** BUILD FAILED **
>
>
> Xcode's output: ↳
> note: Using new build system
> note: Building targets in parallel
> note: Planning build
> note: Analyzing workspace
> note: Constructing build description
> note: Build preparation complete
> /Users/truc/StudioProjects/truc/ios/Pods/Pods.xcodeproj:
> warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set
> to 8.0, but the range of supported deployment target versions is 9.0
> to 14.5.99. (in target 'Reachability' from project 'Pods')
> /Users/truc/StudioProjects/truc/ios/Pods/Pods.xcodeproj:
> warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set
> to 8.0, but the range of supported deployment target versions is 9.0
> to 14.5.99. (in target 'MTBBarcodeScanner' from project 'Pods')
> error: Cycle inside Runner; building could produce unreliable results.
> Cycle details:
> → Target 'Runner': CodeSign /Users/truc/StudioProjects/truc/build/ios/Debug-iphoneos/Runner.app
> ○ Target 'Runner' has copy command from '/Users/truc/StudioProjects/truc/build/ios/Debug-iphoneos/Runner.app'
> to
> '/Users/truc/StudioProjects/truc/build/ios/Debug-iphoneos/Runner.app/Runner.app'
>
> Could not build the precompiled application for the device.
>
> Error launching application on iPhone.
2-我尝试过的:
- 我试过了
打开ios/Runner.xcworkspace
并且在Xcode中选择文件>工作区设置>quot;遗留构建";模式(在另一个stackoverflow线程上找到(但它似乎没有改变任何事情,并且在来自android工作室终端的Xcode注释中;移动到新的构建模式"?
- 也尝试过
打开ios/Runner.xcodeproj
file>项目设置>旧版生成模式。。。也不起作用。。。
我很失望,作为一名安卓开发人员(以及最近的Flutter开发人员(,我真的不知道iOS方面的
谢谢你的帮助!:(
这是我的整个podfile::
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
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.pods_project.targets.each do |target|
# flutter_additional_ios_build_settings(target)
# end
# end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
# config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
在引入第二个目标构建后,我也遇到了同样的问题。对我来说,这是由于错误地将info.plist
和Runner-copy.app
包含在创建循环引用的Xcode Target Membership中造成的。*info.plist
和*.app
不应处于任何目标成员身份中。
这与Podfile中的Targets无关。
要创建第二个Xcode目标,请在Xcode中打开项目并复制Runner目标。这里有一个关于在Xcode中创建Targets的小教程-https://andersongusmao.medium.com/xcode-targets-with-multiples-build-configuration-90a575ddc687.
完成后,您需要选择项目中每个文件的成员身份。大多数人应该是两个/所有目标的成员。如果您有一个特定于一个目标的plist(例如,一个的生产密钥和另一个的开发密钥(,则它们应该仅是关联目标的成员。
如上所述,*info.plist
和*.app
不应处于任何目标成员资格中。