Runtime error when using use_modular_headers
Closed this issue · 24 comments
Hi!
Thanks for writing those articles and making this repo.
I'm trying to use this now, but I get this error:
#### Unsupported Libraries ####
["TwitterKit"]
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `filter' for "":String
remove_ios_only_frameworks.rb:230:in `other_linker_flags_dependencies'
remove_ios_only_frameworks.rb:341:in `block in configure_support_catalyst'
remove_ios_only_frameworks.rb:341:in `each'
remove_ios_only_frameworks.rb:341:in `reduce'
remove_ios_only_frameworks.rb:341:in `configure_support_catalyst'
/Users/zsombor/Development/[...]/Podfile:47:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:857:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:845:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:844:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:325:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:324:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:295:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:174:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
I added this at the end of my Podfile:
def debug
true
end
def catalyst_unsupported_pods
[
'TwitterKit'
]
end
post_install do |installer|
installer.configure_support_catalyst
end
and then run pod install
Thanks!
Hi @zsombornagy ,
Are you using the most updated script (find it here)? I'm running it and it works fine for me:
#### Unsupported Libraries ####
["TwitterKit", "TwitterCore"]
#### Unsupported dependencies ####
["Accounts", "CoreData", "CoreGraphics", "Foundation", "Security", "Social", "UIKit", "AVFoundation", "CoreMedia", "CoreText", "QuartzCore", "SafariServices", "TwitterCore", "TwitterKit"]
#### Frameworks not to be included in the Archive ####
["Accounts.framework", "CoreData.framework", "CoreGraphics.framework", "Foundation.framework", "Security.framework", "Social.framework", "UIKit.framework", "AVFoundation.framework", "Accounts.framework", "CoreData.framework", "CoreGraphics.framework", "CoreMedia.framework", "CoreText.framework", "Foundation.framework", "QuartzCore.framework", "SafariServices.framework", "Security.framework", "Social.framework", "TwitterCore.framework", "UIKit.framework", "TwitterCore.framework", "TwitterKit.framework", "TwitterCore.framework", "Accounts.framework", "CoreData.framework", "CoreGraphics.framework", "Foundation.framework", "Security.framework", "Social.framework", "UIKit.framework", "TwitterKit.framework", "CoreText.framework", "QuartzCore.framework", "CoreData.framework", "CoreGraphics.framework", "Foundation.framework", "Security.framework", "UIKit.framework", "CoreMedia.framework", "AVFoundation.framework", "SafariServices.framework"]
#### Resources not to be included in the Archive ####
["TwitterKitResources.bundle"]
#### Flagging unsupported libraries ####
Target: TwitterCore
Scheme: Release
Succeded
Scheme: Debug
Succeded
Target: TwitterKit
Scheme: Release
Succeded
Scheme: Debug
Succeded
Target: Pods-CollectionViewLayoutExample
Scheme: Release
Succeded
Scheme: Debug
Succeded
#### Filtering build phases ####
#### Filtering dependencies ####
Target: TwitterCore
- Filtering dependencies
Target: TwitterKit
- Filtering dependencies
#### Changing frameworks and resources script ####
Target: Pods-CollectionViewLayoutExample
-Uninstalling frameworks
Uninstalling for configurations: ["Release"]
Succeded
-Uninstalling resources
Uninstalling for configurations: ["Release"]
Succeded
Could you share the script logging, please? I noticed you have debug
set to true
. Also, what version of cocoapods and ruby do you use?
Hi!
Yes, I'm using the latest version. I downloaded it by clicking the "this ruby file" link in the readme. But now I downloaded it again.
Unfortunately I don't have more logs, just what I pasted above.
% pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
#### Unsupported Libraries ####
["TwitterKit"]
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `filter' for "":String
remove_ios_only_frameworks.rb:230:in `other_linker_flags_dependencies'
remove_ios_only_frameworks.rb:341:in `block in configure_support_catalyst'
remove_ios_only_frameworks.rb:341:in `each'
remove_ios_only_frameworks.rb:341:in `reduce'
remove_ios_only_frameworks.rb:341:in `configure_support_catalyst'
/Users/zsombor/Development/vintage/Podfile:47:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:857:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:845:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:844:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:325:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:324:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:295:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:174:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Now I added these lines to the script:
loggs "@#{other_ldflags}@"
loggs "!#{other_ldflags.filter do |flag| true end}!"
(last time I wrote any ruby was 10 years ago, so maybe this is wrong)
this is the output:
% pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
#### Unsupported Libraries ####
["TwitterKit"]
@@
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `filter' for "":String
remove_ios_only_frameworks.rb:231:in `other_linker_flags_dependencies'
this line 231 is the line I added:
loggs "!#{other_ldflags.filter do |flag| true end}!"
now I tried this:
% irb
WARNING: This version of ruby is included in macOS for compatibility with legacy software.
In future versions of macOS the ruby runtime will not be available by
default, and may require you to install an additional package.
irb(main):001:0> emptystring = ""
=> ""
irb(main):002:0> emptystring.filter do |flag| true end
Traceback (most recent call last):
4: from /usr/bin/irb:23:in `<main>'
3: from /usr/bin/irb:23:in `load'
2: from /Library/Ruby/Gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
1: from (irb):2
NoMethodError (undefined method `filter' for "":String)
irb(main):003:0>
am I having some ruby version issue?
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
@zsombornagy the line where it's failing is this
libraries = other_ldflags.filter do |flag| flag.start_with? '-l' end.map do |flag| flag.gsub! /(["|\-l]*)/, '' end.map do |name| PodDependency.newLibrary name end
The error says:
undefined method `filter' for "":String
that means that other_ldflags
is a String
and not an Array
. other_ldflags
is retrieved by using resolve_build_setting(key)
which, according to the documentation, returns an Array
:
other_ldflags = config.resolve_build_setting 'OTHER_LDFLAGS' # this should be an Array
For me, the script runs fine when using that pod TwitterKit (see the log in my previous comment). Could you add this on line 225 and tell me what it prints?
loggs other_ldflags
# It should print:
# ["-framework", "\"Accounts\"", "-framework", "\"CoreData\"", "-framework", "\"CoreGraphics\"", "-framework", "\"Foundation\"", "-framework", "\"Security\"", "-framework", "\"Social\"", "-framework", "\"UIKit\""]
I think this issue has to do with the version of cocoapods. This is the version in my machine:
WRLT0288:~ fernando.moyaderivas$ pod --version
1.9.3
Also, could you add after that line
loggs config
For the configuration name printed, are you doing anything out of the ordinary?
% pod --version
1.9.3
% ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I added these to the script:
loggs "other_ldflags"
loggs other_ldflags
loggs "config"
loggs config
and my output is:
% pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
#### Unsupported Libraries ####
["TwitterKit"]
other_ldflags
config
Release
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `filter' for "":String
remove_ios_only_frameworks.rb:234:in `other_linker_flags_dependencies'
remove_ios_only_frameworks.rb:345:in `block in configure_support_catalyst'
remove_ios_only_frameworks.rb:345:in `each'
remove_ios_only_frameworks.rb:345:in `reduce'
remove_ios_only_frameworks.rb:345:in `configure_support_catalyst'
/Users/zsombor/Development/vintage/Podfile:47:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:857:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:845:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:844:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:325:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:324:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:295:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:174:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
I will try it with a new xcode project later to figure out if something is strange with the project actually.
You wrote that resolve_build_setting
returns an Array, but looking at the documentation it looks like it returns a String... am I reading it wrong?
Thanks for the help!
@zsombornagy I usually look at the code in masters directly, it's more updated. So if you see here:
https://github.com/CocoaPods/Xcodeproj/blob/master/lib/xcodeproj/project/object/build_configuration.rb
You'll see:
# Gets the value for the given build setting considering any configuration
# file present and resolving inheritance between them. It also takes in
# consideration environment variables.
#
# @param [String] key
# the key of the build setting.
#
# @param [PBXNativeTarget] root_target
# use this to resolve complete recursion between project and targets.
#
# @param [String] previous_key
# use this to resolve complete recursion between different build settings.
#
# @return [String] The value of the build setting
#
def resolve_build_setting(key, root_target = nil, previous_key = nil)
...
end
Can you also do xcodeproj --version
and see what version prints for you?
If you do gem environment
you'll see your gems' INSTALLATION DIRECTORY. You can also cd
this folder, cd
your gem xcodeproj
and open lib/xcodeproj/project/object/build_configuration.rb
. In this file, the method resolve_build_setting
should return an Array
I have:
% xcodeproj --version
1.16.0
in /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.16.0/lib/xcodeproj/project/object/build_configuration.rb
I have this:
# @!group Helpers
#---------------------------------------------------------------------#
# Gets the value for the given build setting considering any configuration
# file present and resolving inheritance between them. It also takes in
# consideration environment variables.
#
# @param [String] key
# the key of the build setting.
#
# @param [PBXNativeTarget] root_target
# use this to resolve complete recursion between project and targets.
#
# @param [String] previous_key
# use this to resolve complete recursion between different build settings.
#
# @return [String] The value of the build setting
#
def resolve_build_setting(key, root_target = nil, previous_key = nil)
setting = build_settings[key]
setting = resolve_variable_substitution(key, setting, root_target, previous_key)
config_setting = config[key]
config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
project_setting = project.build_configuration_list[name]
project_setting = nil if equal?(project_setting)
project_setting &&= project_setting.resolve_build_setting(key, root_target)
defaults = {
'CONFIGURATION' => name,
'SRCROOT' => project.project_dir.to_s,
}
# if previous_key is nil, it means that we're back at the first call, so we can replace our sentinel string
# used to prevent recursion with nil
if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
setting = nil
end
[defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
expand_build_setting(value, inherited)
end
end
I don't know enough Ruby anymore to understand if this returns an Array or a String. The docstring says it's a String (right? it's confusing because [String]
would be an array in Swift, but I think here it's just the format of the docstring?), but this last line of this method seems to be working on an Array, but I don't understand what's going on really. I still feel like it actually reduces it down to a String, but I'm probably wrong.
Thank you for trying to fix it for me!
I will try with a new Xcode project, and if that works, I will try to compare with my project to figure out what could be the difference. I'll let you know if I managed to fix it.
OMG, apologies, I'm so used to associate []
with Array
, you're right. Weird enough, when I debug it I get an Array
. I'll keep digging into this too, thanks.
@zsombornagy it's really strange it's not returning a String for me. The problem is I can't see how it looks like when that String
isn't empty. For now you could do this:
if other_ldflags.nil?
return []
end
if other_ldflags.class == String
other_ldflags = other_ldflags.split ' '
end
By the way, I've also noticed that your ruby version is 2.6.3
% pod --version
1.9.3
% ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
but the logs you've shared reference ruby 2.6.0
/Users/zsombor/Development/vintage/Podfile:47:in
block (2 levels) in from_ruby' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:179:in
post_install!'
It's also strange that it returns an empty String. If you look up TwitterKit.debug.xcconfig
and TwitterCore.debug.xcconfig
(or swap debug
in the filename with your build configuration) you should see OTHER_LDFLAGS
isn't empty:
TwitterCore
OTHER_LDFLAGS = $(inherited) -framework "Accounts" -framework "CoreData" -framework "CoreGraphics" -framework "Foundation" -framework "Security" -framework "Social" -framework "UIKit"
TwitterKit
OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "Accounts" -framework "CoreData" -framework "CoreGraphics" -framework "CoreMedia" -framework "CoreText" -framework "Foundation" -framework "QuartzCore" -framework "SafariServices" -framework "Security" -framework "Social" -framework "TwitterCore" -framework "UIKit"
You can see this if you comment the post_install
block inside your Podfile
.
Hi @fermoya
Thanks for sharing the script, unfortunately I'm having the same error.
➜ pod --version
1.9.1
My Podfile:
inhibit_all_warnings!
load 'remove_ios_only_frameworks.rb'
def shared_pods
pod 'Alamofire', '~> 4'
pod 'JGProgressHUD'
pod 'SwiftDate'
pod 'Kingfisher', '~> 5.0'
end
def catalyst_unsupported_pods
["Firebase/Analytics"]
end
target 'MY_APP' do
platform :ios, '12.0'
#use_frameworks!
use_modular_headers!
pod 'JTAppleCalendar', '~> 8'
pod 'Firebase/Analytics'
pod 'FBSDKLoginKit'
shared_pods
end
target 'MY_APP TV' do
platform :tvos, '13.0'
use_frameworks!
shared_pods
end
# https://stackoverflow.com/a/58367269/8397525
# setup podfile to automatically match the deployment target
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
pi.configure_support_catalyst
end
After pod install
, errors below.
➜ pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `filter' for "":String
remove_ios_only_frameworks.rb:230:in `other_linker_flags_dependencies'
remove_ios_only_frameworks.rb:341:in `block in configure_support_catalyst'
remove_ios_only_frameworks.rb:341:in `each'
remove_ios_only_frameworks.rb:341:in `reduce'
remove_ios_only_frameworks.rb:341:in `configure_support_catalyst'
/Users/Tieda/Desktop/MY_APP-ios-app/MY_APP/Podfile:47:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:857:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:845:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:844:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:325:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:324:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:295:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:174:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Seems like something wrong with filter
in ruby? Thank you in advance.
Hi @weitieda ,
This is very strange. I’m using this script myself in production with an even more complex Podfile than the one you share and it’s working fine. Before your comment, I’ve mentioned a possible solution. If you modify the script this way:
if other_ldflags.nil?
return []
end
if other_ldflags.class == String
other_ldflags = other_ldflags.split ' '
end
Could you also update ruby and Cocoapods? I’m seeing in your stacktrace that Cocoapods version is 1.9.1 and Ruby version is 2.6.0. The script is expecting an Array
there, not a String
.
Could you also share the contents of FirebaseAnalytics.debug.xcconfig
, please?
Thanks for your quick reply @fermoya
I just did the following:
- Updated CocoaPods to 1.9.3
- Modified script
if other_ldflags.nil?
return []
end
if other_ldflags.class == String
other_ldflags = other_ldflags.split ' '
end
pod install
, success
Still fail to build with error, but seems like the catalyst app still using Firebase
somewhere.
Undefined symbol: _OBJC_CLASS_$_FIRAnalytics
Undefined symbol: _OBJC_CLASS_$_FIRApp
I guess the script is working fine.
Thanks again for your help and the script :)
@weitieda nope, that error should be fixed by the script. The problem is I can't manage to reproduce this scenario where an empty String is returned and see that error.
Could you do the following, please?
- Remove what you added to the script and check the gem used is cocoa pods version 1.9.3
- Add the snippet below to your
Podfile
and paste here the logging
def debug
true
end
@weitieda good news, I've found out use_modular_headers!
is causing the problem and I get the same error:
undefined method `filter' for "":String
Can I ask why you use it and what's the difference between use_modular_headers!
and use_frameworks!
? I've always used the second option, so I haven't had the opportunity to test the first one.
I'll be working on this tomorrow, should come with a solution soon.
Thanks for your reply.
I started to use use_modular_headers!
few months ago, back then there's a bug that I could not update the pods. After searching, I found use_modular_headers!
works for me(sorry, I can't remember the detail of that error) then until now everything is working fine so I didn't modify it.
@weitieda I've updated the script, can you try again? I've noticed when you use use_modular_headers!
in a target along with use_modular_headers!
along with another target, it'll add -library or -framework to the name.
Let me know if it works now, I think it should. Let's cross fingers.
In your case, you might want to try to compile your TV target too. If you find any issue, please open a new thread
@zsombornagy I think your issue should be fixed if you update the contents of remove_ios_only_frameworks.rb
The updated script works!
Well, at least it doesn't give me an error. But I realized that I don't understand some basic things about cocoapods and catalyst builds. I don't have "use_frameworks!" in my Podfile, and maybe that's the core issue here? Do I need to use frameworks? I guess because I'm not using frameworks, I don't have OTHER_LDFLAGS in the xcconfig files of the pods. (or maybe it's unrelated)
Anyway, I have a lot of reading to do I think. Thanks for all the help!
@zsombornagy I did some digging yesterday. use_frameworks!
will create dynamic libraries, that is, they need to get compiled and linked to the library it references. use_modular_headers!
will create static libraries, so they don't need OTHER_LD_FLAGS
because the dependencies are already included in the binary.
In any case, it's weird that for use_frameworks!
it returns an Array
type whereas for use_modular_headers!
it returns a String
type. In any case, it's handled now