Android Studio, Xcode, Cocopods - xcode

Im new to app development so forgive me if this is a trivial question.
I am trying to build a Flutter application in Android Studios using Xcode simulator as my IOS emulator. When I run main.dart on my application i get the following error in Android Studios console. error message in console
I have tried a variety of fixes but am unsure of any answers.
Delete Podfile and run pod init then pod install
If anyone could shed some light on what is actually wrong with my issue that would be terrific.

Add/ change this at the bottom of your Podfile (located at ios/Podfile)
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'] = '8.0'
end
end
end

Actually the problem is with deployment target. You can change this as following:
Change it to 8.0. If 8.0 is not available then try with other iPhone simulator with a higher iOS version.
And please read your error fully, it mentions about the deployment target.

Related

Building flutter app on iOS simulator failed

I've been developing a flutter app for android for quite some time now, decided to try building it for iOS on a Macbook Pro with M1 Pro chip. Everytime I run it, it works on running pod install and running Xcode build, but always fails at building iOS app. I tried creating a completely new project and run it on my iOS simulator and it worked. Been trying out solutions I could find but none of them worked. Here's the error I get:
xcodebuild[24755:304662] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
xcodebuild[24755:304662] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
and at the end it shows this:
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Any help will be greatly appreciated. Thanks!
Just replace this lines at the end of your Podfile
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ARCHS'] = 'armv7 armv7s'
end
end
end
Flutter > ios > Podfile
Turns out all I needed to do was upgrade all my packages to the latest version, so I did. After resolving some errors caused by upgrading, I was finally able to install my iOS application.

Swift Package Manager and Cocoapods together: Compiler errors in Swift Package after Cocoapod Pod addition

I am developing an iOS app using the ParseSwift SDK. When I set up my project I added ParseSwift via the Swift Package Manager, which worked like a charm. Server connection and saving and querying for data on the server all works and my app compiles in its current state.
To add online meeting capabilities I have been trying to add the JitsiMeet iOS SDK.
After trying to add it via Swift Package Manager, I read on the Jitsi forum that the preferred way of adding it to an existing project is via Cocoapods, and there are currently no plans of supporting the Swift Package Manager. After finding several questions about interoperability of SPM and Cocoapods here I was hoping it would be smooth sailing.
After some back and forth to make Cocoapods work with my M1, I then tried several different Podfile variants to successfully add the JitsiMeetSDK Pod to my project. These variants include:
adding or leaving out the platform part so it is assigned by Cocoapods
adding or leaving out use_frameworks!
installing with or without the post_install block (which is taken from the Jitsi documentation)
This is my Podfile:
platform :ios, '15.0'
target 'MyApp' do
use_frameworks!
pod 'JitsiMeetSDK'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
The short version is: this does not work. My app doesn't compile anymore.
Here is the strange part: while Cocoapods successfully adds the JitsiMeetSDK Pod, when I open the .xcworkspace file and try to compile it I now get tons of compiler warnings for the ParseSwift package that I added via the Swift Package Manager. These errors all concern Concurrency or features only available in iOS 15 - which should not be a problem, since I set the platform to ios, '15.0' in my Podfile.
The ParseSwift files are also annotated and do have checks for Concurrency, which is why I understand this error even less. (screenshots of compiler errors and annotations below)
Is there an order that I have to follow when it comes to adding packages (first Cocoapods, then SPM)? Or any App settings I need to change now that two package managers are in the mix? Any help is appreciated!
I am using
Xcode 13.1
Swift version 5.5.1 (arm64)
Cocoapods 1.11.2 (installed via Home-brew for M1 support)
ParseSwift SDK 2.5.0 (via SPM)
JitsiMeet SDK 4.0.0 (via Cocoapods)
Here is a screenshot of the error messages (one example of almost 300 such cases):
So, I used your Podfile with a new project and ended up with the exact same result.
Then I tried first run Cocoapods for JitsiMeetSDK, then adding the ParseSwift with SPM. Same result.
The only way I was able to make it work was by having Cocoapods install both ParseSwift and JitsiMeetSDK.
platform :ios, '15.0'
target 'TestPackageManagers (iOS)' do
use_frameworks!
pod 'JitsiMeetSDK'
pod 'ParseSwift'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
pod install ran like a charm and I was able to compile and run everything.
You mentioned you are using ParseSwift SDK 2.5.0 in Xcode 13.1. This isn't possible.
Xcode made changes related to backwards compatibility in Xcode 13.2+.
You can resolve everything easily by upgrading to Xcode 13.2+. If you look at the release notes for ParseSwift it says specifically:
Requires Xcode 13.2 or above to use async/await. Not compatible with Xcode 13.0/1, will need to upgrade to 13.2+. Still works with Xcode 11/12
Basically, ParseSwift 2.4.0+ requires Xcode 13.2+. If you want to use Xcode 13.1 or lower, you need to use ParseSwift 2.3.1 or lower. More info can be found in the PR that made the change.
You will face this same issue with any dependency that adds the async/await backwards compatibility for iOS13, so it's recommended to upgrade to Xcode 13.2+ sooner than later.
In addition, the problem isn't related to a mix of SPM and Cocoapods, these dependency managers have nothing to do with each other and you shouldn't have any issues using ParseSwift through SPM along with others in Cocoapods.
The described Concurrency errors were due to updating the ParseSwift package dependencies without updating Xcode to 13.2+ as #CoreyB pointed out.
Xcode 13.2 introduced other, unrelated bugs to my project but solved the Concurrency issue. The bugs were an Xcode 13.2 issue, and updating to Xcode 13.2.1 fixed these bugs.
After the update, I was able to add JitsiMeetSDK via Cocoapods to my existing project.
Thanks to #CoreyB and #Alex Kusmenkovsky for their helpful input!

Flutter - macOS; app run but cannot archive

I had a strange situation that when i run my app is running fine via command line (flutter run) or by using xCode.
But when I choose "Any Mac (Apple Silicon, Intel)" to archive, I got an error:
I tried different methods related with plugins problem, recommended in Github and here. For example, this one:
xCode -> Project -> Clean
deleted Podfile.lock and directory Pods
pod install
flutter clean, flutter run
Everything works smoothly until I try to archive.
This is my macOS Podfile:
platform :osx, '10.11'
# 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', 'ephemeral', '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 Flutter-Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
This is the output of flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.26.0-2.0.pre.86, on Mac OS X 10.15.7 19H114 darwin-x64, locale en-IN)
[✗] 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 12.3)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (3 available)
! Doctor found issues in 2 categories.
Do anyone have any ideas what to do?
Thank you in advance for your support.

Flutter app on Xcode won't launch after upgrade

I have an app made in Flutter and since the latest version of Xcode absolutely nothing works as before.
I have been struggling with this problem for nearly a week now and the errors vary depending on the hour.
The main problem is that when distributing the application to Apple for review, they reject it with the following message:
2.1 Performance: App Completeness Guideline
2.1 - Performance - App Completeness
We discovered one or more bugs in your app when reviewed on iPad
running iOS 14.0 on Wi-Fi.
Specifically, we were still unable to login through Sign in with Apple
I find this strange as all my previous uploads got verified without any problems.
So to rectify this issue I'm trying to run the app through the simulator as I don't own an iPad.
And here is where the problems start.
Side note: Running on a physical iPhone works without problems and I'm opening the project runner.xcworkspace, not the runner.xccodeproj.
The main problem is that Xcode won't find any libraries, starting with the first one:
GeneratedPluginRegistrant.m:10:9: Module 'apple_sign_in' not found
I have tried every solution related to this issue but to no avail.
Remove the pod files, pod install,
pod deintegrate, pod init, pod install
flutter build ios --release, flutter run
Ive tried removing my project and cloning it for a fresh start
Sometimes not even a boilerplate app will work
I have checked github posts like https://github.com/flutter/flutter/issues/53573 and https://github.com/flutter/flutter/issues/33423 with no luck.
...checked countless threads.
Flutter doctor and pod-file below:
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G2021,
locale en-ES)
• Flutter version 1.20.4 at /Users/peter/flutter
• Framework revision fba99f6cf9 (11 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK
version 30.0.1)
• Android SDK at /Users/peter/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at:
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0, Build version 12A7209
• CocoaPods version 1.9.3
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
[!] IntelliJ IDEA Community Edition (version 2017.2.5)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (1 available)
• iPhone 11 (mobile) • F1B8AE15-9028-4E0D-BD9D-2F2C7CC93ECE • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
! Doctor found issues in 2 categories.
podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.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|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
There are problems with Flutter 1.20.4 and XCode12/iOS14.
You need to update Flutter to the current beta (1.22.0-12.3.pre) which contains a lot of fixes for the new iOS/XCode versions.
See https://flutter.dev/docs/development/ios-14
Edit 10/01/2020:
Flutter 1.22.0 has been released to stable and should work with XCode 12 and iOS 14 out of the box.
It might be a problem with the iOS Simulator.
Check out this forum.
You might want to reply to them pointing out this issue from the forum, seems to have worked for others.
Try to allow the module in xcode to see if it finds apple_sign_in
Open Xcode select Runner > Signing % Capabilities > +Capabilities > Select Apple_Sign_In
Xcode screenshot

Xcode 12 deployment target warnings when using CocoaPods

I get this warning on Xcode 12:
The iOS Simulator deployment target IPHONEOS_DEPLOYMENT_TARGET is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99
How to support this version?
A short working solution is here! Just copy and paste the code snippet at the end of your Podfile and run the pod install command.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
In this case, 12.0 is the minimum supporting iOS version for AppStore submission. You can change it based on your project requirements.
This is a problem with the target at your cocoa pods.
To me, the answer was to put this code at the end of your pod file:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
end
end
end
It resolved all my problems, compiling and archiving the project.
Another way is just to change the IPHONEOS_DEPLOYMENT_TARGETin the pods project like described in this image:
Best regards.
Update: To fix this issue you just need to update the Deployment Target to 9.0. This can be updated by opening the .xcworkspace file, choose the Pods.xcodeproj on Xcode, and updating the iOS Deployment Target to 9.0 or later as depicted in the below image.
Another easy fix is to add the following to your Podfile and running pod install on terminal in the directory.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
Previous: You can't provide support for iOS 8.0 on Xcode 12 unless you import the support files. To provide support by default you would have to use Xcode 11. It would be better to check for the number of users that use your app on iOS 8 and update the minimum supported version to iOS 9 or higher.
Flutter now requires an additional line for this to work as of late 2021.
Paste the updated code snippet below at the end of your Podfile and run pod install command.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 10.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
end
Note: If you have the below code in your podfile, then replace it with the above code.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
This is happening because support for iOS 8 has been dropped in Xcode 12 but the minimum deployment target for the offending pod is still iOS 8. This is documented in the Xcode 12 release notes:
Deprecations
Xcode now supports debugging apps and running tests on iOS devices running iOS 9.0 and above.
Workaround. You can append the following to your Podfile as a workaround for now (and then run pod install as usual):
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
end
This will remove the deployment target settings from all pods using iOS 8 or below, allowing them to simply inherit the project deployment target that you have specified at the top of your Podfile. For instance:
platform :ios, '10.0'
I also needed to add
s.platform = :ios, "9.0"
to my .podspec file for this to work, as well as the post_install script from any of the above (or below) answers.
Note: s.platform was
s.platform = :ios
I'm using Flutter so my steps:
delete Podfile.lock file
Change to platform :ios, '10.0'
delete Pods folder in ios folder
Goto Terminal and Pod install everything

Resources