Ios 在项目“Runner”中找不到名为“Runner”的目标。xcodeproj`确实找到了“dev”和“prod”`
所以,我对颤栗是完全陌生的 我得到了一个项目,该项目是在几个月前(2020年12月)在VisualStudio代码上开发的,带有flift和dart,以便将其部署到app store上 我想指出的是,该项目当时运行得非常好,甚至在iPhone上部署了一个测试版本 我必须确保它在本地工作,然后我将把它部署到应用商店 所以我在我的visual studio中打开了这个项目的源代码,我试着编译它,但是没有成功,我不知道当你打开一个项目的源代码时,是否有特定的配置要做 我不确定在打开一个项目的源代码时是否需要进行任何特定的配置,但是在浏览了论坛之后,我意识到错误一定来自于我的flifter的最新版本,而这不是应用程序开发时使用的版本 因此,我按照这个解决方案的指示在这里和这里再次生成我的pod文件。但现在这个错误是在编译时生成的Ios 在项目“Runner”中找不到名为“Runner”的目标。xcodeproj`确实找到了“dev”和“prod”`,ios,xcode,flutter,Ios,Xcode,Flutter,所以,我对颤栗是完全陌生的 我得到了一个项目,该项目是在几个月前(2020年12月)在VisualStudio代码上开发的,带有flift和dart,以便将其部署到app store上 我想指出的是,该项目当时运行得非常好,甚至在iPhone上部署了一个测试版本 我必须确保它在本地工作,然后我将把它部署到应用商店 所以我在我的visual studio中打开了这个项目的源代码,我试着编译它,但是没有成功,我不知道当你打开一个项目的源代码时,是否有特定的配置要做 我不确定在打开一个项目的源代码时是
Launching lib/main.dart on iPhone 8 in debug mode...
Running pod install... 1,674ms
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
[!] Unable to find a target named `Runner` in project `Runner.xcodeproj`, did
find `dev` and `prod`.
有人有主意吗
我以前的pod文件是
# 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 parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end
target 'Runner' do
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers machines .
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
target 'prod' do
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
新创建的一个看起来像
# 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
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
事实上,当我运行颤振博士,我得到
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.2.3 20D91 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.55.2)
[✓] Connected device (2 available)
• No issues found!
实际上,在xcode中打开我的项目给了我这个
我假设您以前使用的是颤振1.X。所以,当我最近下载FlatterV2.0.4时,当我第一次打开我的旧项目时,vscode会显示我的所有文件都包含错误。所以我要做的就是运行
flatterpub-get
。这将消除错误。接下来,我尝试在iOS模拟器中以调试模式运行。之后,我用xcode打开ios(项目内部)文件夹,单击“targets”下的Runner并检查签名,然后在我的iphone上测试它
因此,在您的情况下,放弃您最近所做的任何更改,或者如果您首先需要,将其保存在git中。然后运行flatterpub-get
,首先在模拟器上进行测试
还请注意,无论何时运行flatterclean
,都必须再次运行flatterpub get
。否则您将看到VSCode将以红色显示lib文件夹中的所有文件
$flatter clean
$flatter酒吧
$cd ios
$rm Podfile
$pod设置
$flatterbuildios
你是先在xCode中打开的吗?也许可以帮助你。你能指定以前的颤振版本、当前版本,然后运行颤振医生
并在这里共享输出吗?@HuthaifaMuayyad i,虽然我想在appstore上发布应用时使用它。。。我真的不知道这是怎么回事works@AlexanderDischberg我修改了我的帖子,以便有足够的空间粘贴我的pod文件。我尝试了一下,但是我遇到了这个错误,假设我的pod文件“正在运行pod安装”仍然存在问题。。。1940ms CocoaPods的输出:↳ [!]无效的Podfile
文件:没有将nil隐式转换为字符串从/Users/vanesa/Documents/VSProjects/teichmanmaster org/ios/Podfile:54#--------------------------------------------------除非File.exist?(复制的"framework"路径)>FileUtils.cp(File.join(缓存的"framework"flatter.framework),复制的"flatter"(dir)#end`@Reims好的,我添加了一些在更新颤振版本时记录的附加步骤。