Closed cf-lam closed 3 years ago
@cf-lam Can you provide ios/podfile ? Try to integrate below snippet in it:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Also, provide flutter run --verbose
and attach the entire log in a text file.
Alternatively, try below commands and see if it helps or shows same error:
$ rm ios/Flutter/Flutter.podspec
$ flutter clean
@cf-lam Can you provide ios/podfile ? Try to integrate below snippet in it:
Before you try adding anything, please attach your existing Podfile. Have you made any manual changes to it?
@jmagman No manual changes I can think of recently. Here's the podfile
platform :ios, '11.0'
workspace 'nOCD.xcworkspace'
use_frameworks!
inhibit_all_warnings!
def shared_pods
pod 'Alamofire', '~> 4.8.2.0'
pod 'Atributika', '~> 4.9.10'
pod 'Charts', :git => 'https://github.com/treatmyocd/Charts.git', :branch => 'roundedBars'
pod 'Kingfisher', '~> 5.15.8'
pod 'PromiseKit', '~> 6.13.1'
pod 'SnapKit', '~> 5.0.1.0'
pod 'SwiftyJSON', '~> 5.0.0.0'
pod 'Toast-Swift', '~> 5.0.1.0'
pod 'UITextView+Placeholder', '~> 1.4.0'
end
def main_project_pods
pod 'AFNetworking', '~> 4.0.1.0'
pod 'Analytics', '~> 4.1.2'
pod 'AppsFlyerFramework', '~> 6.1.2'
pod 'Branch', '~> 0.36.0'
pod 'Cloudinary', '~> 2.9.0'
pod 'CryptoSwift', '~> 1.3.8'
pod 'FaveButton', '~> 3.2.1.0'
pod 'Firebase/Analytics'
pod 'Firebase/Core', '~> 7.3.0'
pod 'Firebase/Crashlytics'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Messaging'
pod 'GooglePlaces', '~> 4.1.0'
pod 'Iterable-iOS-SDK', '~> 6.2.17'
pod 'NextGrowingTextView', '~> 1.6.1'
pod 'PubNub', '~> 4.13.1'
pod 'Pulley', '~> 2.9.0'
pod 'SwiftyGif', '~> 5.3.0'
pod 'TTTAttributedLabel', '~> 2.0.0.0'
# obj-c
pod 'BEMSimpleLineGraph'
pod 'EAIntroView', '~> 2.12.0.0'
pod 'EFCircularSlider', '~> 0.1.0.0'
pod 'GKActionSheetPicker', '~> 0.5.1.0'
pod 'SMPageControl', '1.2.0.0'
pod 'UICKeyChainStore', '~> 2.1.1.0'
end
flutter_application_path = './my_flutter/'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'nOCD' do
shared_pods
main_project_pods
install_all_flutter_pods(flutter_application_path)
end
target 'Exercises' do
project 'FrameworkWorkspaces/Exercises/Exercises.xcodeproj'
shared_pods
end
target 'ExercisesApp' do
project 'FrameworkWorkspaces/Exercises/Exercises.xcodeproj'
shared_pods
end
target 'nOCDUITests' do
shared_pods
main_project_pods
pod 'Swifter', '~> 1.4.3'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
if ["wakelock", "auto_orientation", "audioplayers", "flutter_pubnub"].include? target.name
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
# Flutter Permission Handler library
# https://github.com/Baseflow/flutter-permission-handler
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=0',
## dart: PermissionGroup.microphone
'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
end
end
end
@darshankawar is flutter_additional_ios_build_settings needed for Add to App integrations of Flutter inside a native iOS app?
I already tried
$ rm ios/Flutter/Flutter.podspec
$ flutter clean
from an StackOverflow answer and it did not fix my issue.
I was able to run flutter run --verbose
and it was able to build the submodule and run on iPhone simulator. I've attached the large text output after running the command.
I'm guessing this is because you aren't setting EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64
for all your targets. See https://flutter.dev/docs/development/add-to-app/ios/project-setup#apple-silicon-arm64-macs for details.
Can you attach the full logs from a failing build? I can probably tell from the linker flags.
@darshankawar is flutter_additional_ios_build_settings needed for Add to App integrations of Flutter inside a native iOS app?
Also, no, flutter_additional_ios_build_settings
isn't relevant for the add-to-app host Podfile.
@jmagman I have excluded arm64 architecture for simulator builds for the main app target, but not for the Pods project nor the individual pod targets except for the ones specified in the Podfile:
"wakelock", "auto_orientation", "audioplayers", "flutter_pubnub"
I will try excluding for Pods project and/or all the individual pod targets and see if that fixes the issue.
Here's the full build log corresponding to the Podfile above for a failing build. Excluding arm64 architecture at Pod project level resulted in a ton of Swift linking errors. Excluding arm64 architecture for all the other flutter pod targets resulted in other linker errors.
It's failing compiling a webview_flutter
x86 file because the linker flags aren't right. It's -F/Users/christopher/gitrepos/nocd-ios-client-2/my_flutter/.ios/Flutter/engine
but it needs to be -F/Users/christopher/gitrepos/nocd-ios-client-2/my_flutter/.ios/Flutter/engine/Flutter.xcframework/ios-x86_64-simulator/
CocoaPods can't find the arm64 simulator Flutter.xcframework slice (because it's not supported):
warning: [CP] Unable to find matching .xcframework slice in '/Users/christopher/gitrepos/nocd-ios-client-2/Pods/../my_flutter/.ios/Flutter/engine/Flutter.xcframework Flutter framework ios-x86_64-simulator ios-armv7_arm64' for the current build architectures (arm64 x86_64).
and so it's not setting up the linker flags correctly. You need to exclude arm64
for sdk=iphonesimulator*
for ALL targets, including your app target as described in https://flutter.dev/docs/development/add-to-app/ios/project-setup#apple-silicon-arm64-macs.
Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v
.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Steps to Reproduce
Expected results:
iOS application with Flutter Add to App submodule should build for simulator. (Confirmed that it works when deploying to physical device from XCode)
Actual results:
XCode build results in error inside webview_flutter pod target:
Logs
``` ``` ``` ``` [✓] Flutter (Channel beta, 1.26.0-17.8.pre, on macOS 11.1 20C69 darwin-x64, locale en-US) • Flutter version 1.26.0-17.8.pre at /Users/christopher/gitrepos/flutter • Framework revision 044f2cf560 (6 days ago), 2021-02-24 13:02:05 -0800 • Engine revision 042c82b02c • Dart version 2.12.0 (build 2.12.0-259.16.beta) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/christopher/Library/Android/sdk • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] Connected device (1 available) • Stephen’s iPhone (mobile) • e277a9b432a8b945e5ed2a372969883c8a8a88b4 • ios • iOS 14.4 • No issues found!