🙄
xcode16.2でiPhone実機ビルドできない?
なぜできないのか?
参考にならなかったが過去文献を調べてみる。
iOS 13.0を指定。Podfileも設定する。
flutter doctorしても問題なし。謎だった?
# Uncomment this line to define a global platform for your project
platform :ios, '13.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)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
AIに聞いた方法も試す
このエラーは、Podfileの設定とXcodeのビルド設定に関する問題です。以下の手順で解決しましょう:
- まず、ios/Podfileを開き、プラットフォームのバージョンを明示的に指定:
# Podfileの先頭に追加
platform :ios, '13.0'
# 既存の内容はそのまま
- ios/Flutter/Release.xcconfig ファイルを開き、以下の行を追加:
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
- ios/Flutter/Debug.xcconfig ファイルも同様に編集:
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
- クリーンアップと再インストール:
cd ios
rm -rf Pods
rm -rf Podfile.lock
pod deintegrate
pod cache clean --all
pod install
cd ..
flutter clean
flutter pub get
- Xcodeでプロジェクトを開き、Build Settingsを確認:
- RunnerターゲットのBuild Settings
- "Config"で検索
- Debug, Release, Profileの設定が正しいか確認
これらの手順を実行後、再度ビルドを試してください。
特定の機種だけビルドできない?
SwiftUIだと問題なし???
いやあとで治っている???
xcodeでビルドしたら治る?
さっきは無理だったが。。。
iPhoneに問題があることもある。しかし表示されるていない設定があると解決の使用がない?
なぜ治ったかは謎だ。
- 使用した機種
- iPhoneSE
- iPhone11
Discussion
このコマンドを実行すると治ることあるようだ?