Running Flutter on IOS - Module 'cloud_firestore' not found - xcode

I have tried all of the solutions I could find on Stack Overflow for this problem. When I build my flutter app, I get this error:
Module 'cloud_firestore' not found
I am using flutter 2.10.4 and xcode 13.3
Here is my podfile:
# Uncomment this line to define a global platform for your project
#platform :ios, '15.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
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)
end
end

Related

PhaseScriptExecution failed with a nonzero exit code when archiving only

Stuck for a week and yet can't find a solution I did everything but I can't archive the is to submit it to AppStore. It runs on Simulator smoothly with no issues but when I click archive the below error return
PhaseScriptExecution Run\ Script /Users/auser/Library/Developer/Xcode/DerivedData/Runner-evxpqziwqhmcfdeqitqdevhmsglz/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh (in target 'Runner' from project 'Runner')
cd /Users/auser/Documents/Mobile\ Apps/Flutter/flutterproj/ios
export ACTION\=install
export AD_HOC_CODE_SIGNING_ALLOWED\=NO
export ALLOW_TARGET_PLATFORM_SPECIALIZATION\=NO
export ALTERNATE_GROUP\=staff
export ALTERNATE_MODE\=u+w,go-w,a+rX
export ALTERNATE_OWNER\=username
export ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES\=YES
export ALWAYS_SEARCH_USER_PATHS\=NO
export ALWAYS_USE_SEPARATE_HEADERMAPS\=NO
export APPLE_INTERNAL_DEVELOPER_DIR\=/AppleInternal/Developer
export APPLE_INTERNAL_DIR\=/AppleInternal
export APPLE_INTERNAL_DOCUMENTATION_DIR\=/AppleInternal/Documentation
export APPLE_INTERNAL_LIBRARY_DIR\=/AppleInternal/Library
export APPLE_INTERNAL_TOOLS\=/AppleInternal/Developer/Tools
export APPLICATION_EXTENSION_API_ONLY\=NO
export APPLY_RULES_IN_COPY_FILES\=NO
export APPLY_RULES_IN_COPY_HEADERS\=NO
export ARCHS_STANDARD\=arm64
export ARCHS_STANDARD_32_64_BIT\=armv7\ arm64
export ARCHS_STANDARD_32_BIT\=armv7
export ARCHS_STANDARD_64_BIT\=arm64
export ARCHS_STANDARD_INCLUDING_64_BIT\=arm64
export ARCHS_UNIVERSAL_IPHONE_OS\=armv7\ arm64
export ASSETCATALOG_COMPILER_APPICON_NAME\=AppIcon
export ASSETCATALOG_COMPILER_FLATTENED_APP_ICON_PATH\=/Users/auser/Library/Developer/Xcode/DerivedData/Runner-evxpqziwqhmcfdeqitqdevhmsglz/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/ProductIcon.png
export ASSET_PACK_FOLDER_PATH\=/Users/auser/Library/Developer/Xcode/DerivedData/Runner-evxpqziwqhmcfdeqitqdevhmsglz/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/OnDemandResources
export variant\=normal
/bin/sh -c /Users/auser/Library/Developer/Xcode/DerivedData/Runner-evxpqziwqhmcfdeqitqdevhmsglz/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
Failed to package /Users/auser/Documents/Mobile Apps/Flutter/flutterproj.
Command PhaseScriptExecution failed with a nonzero exit code
My Podfile code:
# Uncomment this line to define a global platform for your project
platform :ios, '11.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)
end
end
The flutter pubspec.yaml
name: application_name
description: Application Description
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.18.2 <3.0.0"
dependencies:
cupertino_icons: ^1.0.2
firebase_core: ^2.4.1
firebase_messaging: ^14.2.1
flutter:
sdk: flutter
flutter_launcher_icons: ^0.11.0
flutter_local_notifications: ^13.0.0
flutter_native_splash: ^2.2.16
flutter_offline: ^2.1.0
internet_connection_checker: ^1.0.0+1
url_launcher: ^6.1.7
webview_flutter: ^3.0.4
dev_dependencies:
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
flutter_icons:
image_path_android: "assets/playstore.png"
image_path_ios: "assets/appstore.png"
android: true
ios: true
remove_alpha_ios: true
adaptive_icon_background: "#fff"
flutter_native_splash:
#image: ""
image: assets/splash_screen.jpg
background_image: assets/splash_screen.jpg
#color: ""
android: true
ios: true
ios_content_mode: scaleToFill
android_12:
image: assets/splash_screen.jpg
icon_background_color: "#BD081B"
I m using Xcode 14.2, MacOS Ventura 13.2, pod 1.11.3, ruby 3.0.2p107
Build Phase Screenshots
I faced a similar issue before the solution was to downgrade (or install an older version of xcode) back then the issue was resolved by installing Xcode 13.2, I believe now MacOS prevents any old versions (older than 14). the issue might not be from your code, it might be from a package not compatible with the xcode building process.

dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit - macCatalyst

Run fails with the error for mac Catalyst
require 'cocoapods-catalyst-support'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
pod 'SwiftyStoreKit'
end
# Configure your macCatalyst dependencies
catalyst_configuration do
# Uncomment the next line for a verbose output
verbose!
# ios '<pod_name>' # This dependency will only be available for iOS
# macos '<pod_name>' # This dependency will only be available for macOS
end
post_install do |installer|
installer.configure_catalyst
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'Yes'
end
end
end
end
This is my podfile ,ya this contains more pods other. than SwiftyStoreKit.
i am able to run without the SwiftyStoreKit, but if i add at then getting this error and breakpoint
dyld: Library not loaded: #rpath/SwiftyStoreKit.framework/Versions/A/SwiftyStoreKit
Referenced from: /Users/admin/Library/Caches/...../Build/Products/Debug-maccatalyst/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
i am using this tool to exclude pods for mac catalyst: https://github.com/fermoya/cocoapods-catalyst-support
using
Xcode : 12.4
macOS : Big Sur 11.2.2
Integrating SwiftStoreKit with Swift Package Manager solves the issue.
If you are using Xcode 11 or later:
Click File
Swift Packages
Add Package Dependency...
Specify the git URL for SwiftyStoreKit.
https://github.com/bizz84/SwiftyStoreKit.git

Syntax error in Cocoapods podfile

When I run the "pod install" command in the Terminal, I get this error message:
[!] Invalid `Podfile` file: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('.
# from /Users/pdenlinger/Desktop/Clima-master/Podfile:1
# -------------------------------------------
> Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
# -------------------------------------------
Here are the contents of the podfile, which I edited with Xcode:
Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Clima' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Clima
pod 'SwiftyJSON'
pod 'Alamofire'
pod 'SVProgressHUD'
end
Comment the first line:
#Uncomment the next line to define a global platform for your project
Not a great error message ...

cocoapods pod file dependency issue with Firebase, specifically FirebaseUI

I am trying to use the Firebase Storage documented example code :
// Reference to an image file in Firebase Storage
let reference = storageRef.child("images/stars.jpg")
// UIImageView in your ViewController
let imageView: UIImageView = self.imageView
// Placeholder image
let placeholderImage = UIImage(named: "placeholder.jpg")
// Load the image using SDWebImage
imageView.sd_setImage(with: reference, placeholderImage: placeholderImage)
adapted like so in my app:
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(getuid())/thumb_\(picid).jpg");
let placeholderImage = UIImage(named: "placeholder.jpg")
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
}
but the method sd_setImage was not found by xcode so I thought I had to update my podfile with the pod 'FirebaseUI/Storage' but after tinkering with my podfile I get this error:
pod update
Update all pods
Updating local specs repositories
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master fetch origin --progress
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 12), reused 7 (delta 4), pack-reused 0
From https://github.com/CocoaPods/Specs
24df16553de..7cae8225fce master -> origin/master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/myname/.cocoapods/repos/master reset --hard origin/master
HEAD is now at 7cae8225fce [Add] MixedRealityKit 0.1.6
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `TwitterCore (~> 2.8.0)` required by `Podfile`
- `TwitterCore (>= 3.0.0)` required by `TwitterKit (3.0.0)`
- `FirebaseUI` required by `Podfile`
Specs satisfying the `FirebaseUI` dependency were found, but they required a higher minimum deployment target.
My pods file is like so though I have tried other pod combinations but to the same or worse effect:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
target 'StrengthStandards' do
#Pods for StrengthStandards
pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
What am I doing wrong? Also my xcode gives the error No such module 'FirebaseAuthUI' on my import FirebaseAuthUI line.
Before this problem I had my Firebase Database and Firebase Auth working.
I am using Xcode 8.3.3 and Swift 3, on MacOS 10.12.6
Thanks
PS: making some progress - now my podfile is:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
#Pods for StrengthStandards
#pod 'Firebase'
pod 'Firebase/Core'
#pod 'Firebase/Auth'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
#pod 'FirebaseUI/Google'
#pod 'Firebase/Crash'
#pod 'Firebase/RemoteConfig'
#pod 'FirebaseUI'
pod 'Firebase/Database'
#pod 'FirebaseUI/Database'
#pod 'Firebase/Storage'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and I no longer get the dependancy issues however, xcode now tells me that the method call
profilePicIV.sd_setImage(with: imagesRefs, placeholderImage: placeholderImage)
is wrong:
/Users/myname/Dev/IOSDev/StrengthStandards/StrengthStandards/Settings.swift:325:40: Cannot convert value of type 'StorageReference' to expected argument type 'URL?'
Seems to work now though I admit I'm not sure if it is exactly the way it is supposed to be done. For anyone interested here is what I have so far:
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
target 'StrengthStandards' do
use_frameworks!
pod 'Firebase/Core'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'Firebase/Database'
pod 'FirebaseUI/Storage'
pod 'TwitterCore', '~>2.8.0'
pod 'SDWebImage/Core'
target 'StrengthStandardsTests' do
inherit! :search_paths
# Pods for testing
end
target 'StrengthStandardsUITests' do
inherit! :search_paths
# Pods for testing
end
end
and here is my function:
import SDWebImage
func setImage(_ picid: Int32){
let imagesRefs = Constants.FirebaseConfig.storageRef.child("images/thumbs/\(Constants.getUID())/thumb_\(picid).jpg");
imagesRefs.downloadURL { url, error in
if let error = error {
// Handle any errors
print("Error getting url for profile pic: \(error)")
} else {
// Get the download URL for 'images/stars.jpg'
let placeholderImage = UIImage(named: "placeholder.jpg")
self.profilePicIV.sd_setImage(with: url, placeholderImage: placeholderImage)
}
}
}

Can't build tvOS app with Cocoapod dependencies with xctool

I have a project that has a small number of dependencies managed with Cocoapods. I can build it fine from Xcode but when I try to build it using xctool, or travisci, I get an error:
xcodebuild clean VideoStationViewer
Pods / SwiftyJSON (Debug)
✗ Check dependencies (37 ms)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Check dependencies
target 'SwiftyJSON' has bitcode disabled (ENABLE_BITCODE = NO), but it is required for the 'appletvos' platform
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1 errored, 0 warning (38 ms)
Pods / Alamofire (Debug)
✗ Check dependencies (38 ms)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Check dependencies
target 'Alamofire' has bitcode disabled (ENABLE_BITCODE = NO), but it is required for the 'appletvos' platform
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1 errored, 0 warning (38 ms)
Pods / OHHTTPStubs (Debug)
✗ Check dependencies (40 ms)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Check dependencies
target 'OHHTTPStubs' has bitcode disabled (ENABLE_BITCODE = NO), but it is required for the 'appletvos' platform
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1 errored, 0 warning (47 ms)
I'm guessing that xctool is using different parameters to build than Xcode does but not sure what is different or how to tell xctool to use those settings and then how to configure Travisci to use it too.
try adding the following snippet to the bottom of your Podfile, then do pod install:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'YES'
end
end
end
#Campbell_Souped’s answer works great for tvOS-only projects, but if you try to also build for OS X, you’ll get an error that Bitcode is not supported. This version checks the platform before enabling Bitcode:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.platform_name == :tvos || target.platform_name == :watchos then
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'YES'
end
end
end
end

Resources