Closed bhayatus closed 2 years ago
It looks like it is related to this:
@johnsouza-loftbr do you have any idea?
@danielgomezrico not yet, let me do some digging and reach you guys as soon as possible.
hi @bhayatus! Can you tell me if the problem occurs when you build for debug or release?
@johnsouza-loftbr I didn't try release mode but building in debug mode was what led to this.
@bhayatus thank you! Did some digging here and couldn't reproduce the problem. While I keep doing the dig part, let me ask you: you tried flutter clean
and a XCode full clean? Sometimes XCode loses itself when working with libraries that changes dependencies. So my suggestion is:
flutter clean
;rm -rf ~/Library/Developer/Xcode/DerivedData
;After doing that, can you confirm if the problem persists please?
Tried what was suggested, still an issue. Here's flutter doctor on my MacBook if that helps.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.3.1 21E258 darwin-arm, locale
en-CA)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.68.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
! Doctor found issues in 2 categories.
Hmmm. Can you copy the content of your Podfile here, please?
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
pod 'Analytics', '~> 4.1'
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['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
end
end
end
Ok, right now I have two guesses:
pod deintegrate
and then pod install
should fix;My guts points that option 1 will resolve, because I was unable to reproduce the problem, by updating to 3.9.0 and by using 3.9.0 on a new app.
Can you try that? I'm waiting for you answer on that.
Still not working. I'm reading online that newer versions of Xcode flag this as an issue, is it possible you are using an older version?
Using the last stable release (13.4.1) here. Will create a new fork with some changes and reach you when it's ready for testing, ok?
Absolutely, I appreciate the speed of your replies.
Just trying to help (and I don't like the ideia that someone's job is stuck because of me haha).
Just found something that can be helpful, last attempt to fix that without needing a new version of the plugin:
Add this line of code in your Podfile, inside post_install declaration:
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
So your Podfile will look like:
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
pod 'Analytics', '~> 4.1'
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['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end
end
That worked, though seems like a band aid solution. Thanks for the fix in any case.
Yay! And i agree with you, it's not the better solution, but at least you have your project working again.
I'll made the changes needed and when everything is good to go @danielgomezrico will release a new version, ok?
Thank you for you patience and help!
Is that something that must be done inside the library setup or that each client must do that on their personal podfile?
@danielgomezrico I'm not 100% sure about the solution, maybe is the one that I described to @bhayatus. But my will is to solve inside the library, to avoid the need of adding something to the Podfile.
Right now I'm trying to reproduce the error, so can I start evaluating other solutions.
There's one way to cleanup your local dependencies on iOS:
rm -rf ios/Pods/ || true
rm ios/Podfile.lock || true
flutter clean
flutter pub get
cd ios && pod repo update
Maybe that helps?
@danielgomezrico thanks! Did that but the error still do not happen. @bhayatus have you tried to create a new flutter project, add the flutter_segment: 3.9.0 and run it on the iOS emulator?
So I tried a new Flutter project, and no issues running with 3.9.0
. Then I decided to compare the Podfiles. Decided to remove the line pod 'Analytics', '~> 4.1'
and the issue went away, even without the fix mentioned above. I'm not sure why the dependency was added originally (or why it causes the issue for that matter), since this plugin doesn't require that being there.
So @bhayatus we can close this issue?
I believe I should be good after making this change, thanks again.
After upgrading to 3.9.0, I keep getting an error when Xcode tries to build the app on iOS.