Skip to content

Commit b011188

Browse files
committed
🐛 [iOS] Fix Podfile
1 parent e167f0a commit b011188

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

example/ios/Podfile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '11.3'
2+
platform :ios, '11.3'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -27,15 +27,45 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
2727

2828
flutter_ios_podfile_setup
2929

30+
def install_plugin_pods(application_path = nil, relative_symlink_dir, platform)
31+
# defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
32+
application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
33+
raise 'Could not find application path' unless application_path
34+
35+
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
36+
# referring to absolute paths on developers' machines.
37+
38+
symlink_dir = File.expand_path(relative_symlink_dir, application_path)
39+
system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.
40+
41+
symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
42+
system('mkdir', '-p', symlink_plugins_dir)
43+
44+
plugins_file = File.join(application_path, '..', '.flutter-plugins-dependencies')
45+
plugin_pods = flutter_parse_plugins_file(plugins_file, platform)
46+
plugin_pods.each do |plugin_hash|
47+
plugin_name = plugin_hash['name']
48+
plugin_path = plugin_hash['path']
49+
if (plugin_name && plugin_path)
50+
specPath = "#{plugin_path}/#{platform}/#{plugin_name}.podspec"
51+
pod plugin_name, :path => specPath
52+
end
53+
end
54+
end
55+
3056
target 'Runner' do
3157
use_frameworks!
3258
use_modular_headers!
3359

34-
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
60+
flutter_install_ios_engine_pod(File.dirname(File.realpath(__FILE__)))
61+
install_plugin_pods(File.dirname(File.realpath(__FILE__)), '.symlinks', 'ios')
3562
end
3663

3764
post_install do |installer|
3865
installer.pods_project.targets.each do |target|
3966
flutter_additional_ios_build_settings(target)
67+
target.build_configurations.each do |config|
68+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.3'
69+
end
4070
end
4171
end

0 commit comments

Comments
 (0)