flutter问题

问题一

1.报错:

Flutter ios/Flutter/Debug.xcconfig: unable to open file (in target "Runner" in project "Runner")

2.解决:

cd 项目目录

flutter clean

flutter create --org solanddriver .

运行Xcode

问题二

1.Cannot run with sound null safety, because the following dependencies

解决方案:

可以直接在命令行中执行

flutter run --no-sound-null-safety

也可以到Android studio中去设置运行配置

首先打开Edit Configurations 页面

然后在Additional run args 这行键入一下命令

--no-sound-null-safety

如图所示

flutter问题_第1张图片

然后点击OK,再次重新运行就可以了

2.building for iOS Simulator, but linking in object file built for iOS, file for architecture arm64

podfile文件末尾添加以下脚本:然后执行pod install 命令。

post_install do |installer|

installer.pods_project.targets.each do |target|

target.build_configurations.each do |config|

config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"

end

end

end

platform :ios, '11.0'

inhibit_all_warnings!

source 'http://pods.pajk-ent.com/CocoaPods/Specs'

source '[email protected]:ios_group/lantern.git'

# 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!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

pod 'FlutterPluginRegistrant', :path => File.join('Flutter', 'FlutterPluginRegistrant'), :inhibit_warnings => true

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["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"

end

end

end

你可能感兴趣的:(iOS-学习资料,flutter,xcode,ios)