Skip to content

CocoaPods for MaterialComponents/TextControls fails #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dangrima90 opened this issue Jun 22, 2022 · 14 comments
Closed

CocoaPods for MaterialComponents/TextControls fails #392

dangrima90 opened this issue Jun 22, 2022 · 14 comments

Comments

@dangrima90
Copy link
Contributor

A bit of a weird issue but I can't seem to figure out what the issue is. When trying to use @nativescript-community/ui-material-textfield I can't use version 7 of the package on iOS.

I'm always getting the following error:

image

The screenshot displays the error being shown for MaterialComponents/TextControls+UnderlinedTextFields, but each time I try to run a different MaterialComponents/TextControls Pod gets listed. Basically it's always one of the following:

pod 'MaterialComponents/TextControls+FilledTextFields'
pod 'MaterialComponents/TextControls+UnderlinedTextFields'
pod 'MaterialComponents/TextControls+OutlinedTextFields'
pod 'MaterialComponents/TextControls+FilledTextFieldsTheming'
pod 'MaterialComponents/TextControls+UnderlinedTextFieldsTheming'
pod 'MaterialComponents/TextControls+OutlinedTextFieldsTheming'

Which of course it's understandable as these are the dependencies of @nativescript-community/ui-material-textfield.

I've tried countless things from updating pods, to reinstalling pods, clearing the cache, trying to force the pods version myself, trying different 7.x versions - but no luck whatsoever.

With @nativescript-community/ui-material-textfield version 6 I've seen no problems. However I'm at a point where I need to use both @nativescript-community/ui-material-textfield and @nativescript-community/ui-material-bottomsheet. Since I need bottom sheet v7, all material components should be using v7 so that the core is using the same version. However I'm stuck as when trying to run on iOS it always fails due to MaterialComponents/TextControls.

I understand that it might be difficult to deduce what the issue is, but any idea what could be the problem here?

@farfromrefug
Copy link
Member

@dangrima90 did you run pod repo update ?

@dangrima90
Copy link
Contributor Author

@farfromrefug Yes ran pod repo update. Same goes for pod install --repo-update. I've also tried clearing the cache: pod cache clean --all. No luck

@farfromrefug
Copy link
Member

@dangrima90 you can look in the podfile lock to see what version is installing. It should be the latest.
If not then something is preventing you from installing latest from cocoapod. maybe you need platform :ios, '10.0' in your pdofile?

@dangrima90
Copy link
Contributor Author

Unfortunately I can't see what's in the podfile lock since the build is failing the file is not created.

I added platform :ios, '10.0' to my podfile but still the same result:
image

@farfromrefug
Copy link
Member

@dangrima90 cant tell you much more. The pod specs are correct https://github.com/CocoaPods/Specs/blob/master/Specs/0/1/9/MaterialComponents/124.2.0/MaterialComponents.podspec.json and MaterialComponents/TextControls+UnderlinedTextFields exists. There must be another plugin which prevent you from installing latest. Like another plugin forcing MaterialComponents pod version

@dangrima90
Copy link
Contributor Author

dangrima90 commented Jun 22, 2022

@farfromrefug Understood, thanks for the info. So I've analysed the generated podfile and here's all the references to MaterialComponents:

# Begin Podfile - /Users/gria001/Code/transfers/node_modules/@nativescript-community/ui-material-textfield/platforms/ios/Podfile
pod 'MaterialComponents/TextControls+FilledTextFields'
pod 'MaterialComponents/TextControls+UnderlinedTextFields'
pod 'MaterialComponents/TextControls+OutlinedTextFields'
pod 'MaterialComponents/TextControls+FilledTextFieldsTheming'
pod 'MaterialComponents/TextControls+UnderlinedTextFieldsTheming'
pod 'MaterialComponents/TextControls+OutlinedTextFieldsTheming'
# pod 'MaterialComponents/TextFields+Theming'
# End Podfile

# Begin Podfile - /Users/gria001/Code/transfers/node_modules/@nativescript/core/platforms/ios/Podfile
# platform :ios, '12.0'
use_frameworks!

pod 'MaterialComponents/Tabs', '~> 94.5'

def post_install_nativescript_core_0 (installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
# End Podfile

# Begin Podfile - /Users/gria001/Code/transfers/node_modules/@nativescript-community/ui-material-core/platforms/ios/Podfile
pod 'MaterialComponents/schemes/Color'
pod 'MaterialComponents/Ripple'

# End Podfile

Could any of these be creating a problem?

@farfromrefug
Copy link
Member

@dangrima90 this is /your issue pod 'MaterialComponents/Tabs', '~> 94.5'
You are not using N 8? You might need to upgrade because of this.

@dangrima90
Copy link
Contributor Author

dangrima90 commented Jun 22, 2022

Ehh thought so - We're stuck with NativeScript 7 unfortunately 😞 Not sure if there's a way for us to "override that part". In our app we don't use the tabs themselves.

@dangrima90
Copy link
Contributor Author

Asking as I saw this a few moments ago (NativeScript/nativescript-cli#5061) But I'm not so sure how it can be used.

@farfromrefug
Copy link
Member

@dangrima90 you can create a hook to modify the podfile and remove it. This is what i did in 5.x and 6.x of material components. You should be able to find it in git history

@dangrima90
Copy link
Contributor Author

Alright time to go back in history then 😆 thanks for your help

@dangrima90
Copy link
Contributor Author

dangrima90 commented Jun 22, 2022

@farfromrefug I solved it. Didn't need to use the hooks.

nativescript.config.ts

import { NativeScriptConfig } from '@nativescript/core';

export default {
  id: 'transfers.medirect',
  appPath: 'src',
  appResourcesPath: 'App_Resources',
  android: {
    v8Flags: '--expose_gc',
    markingMode: 'none'
  },
  overridePods: 'true' // <----- set overridePods to true
} as NativeScriptConfig;

App_Resources/iOS/Podfile

pod 'MaterialComponents/Tabs'

Thanks for your help :)

@farfromrefug
Copy link
Member

@dangrima90 wow did not know about that option !!!

@dangrima90
Copy link
Contributor Author

From what I'm seeing in NativeScript 6 it used to exist but it was a boolean in a JSON file.

Now for NativeScript 7 I'm seeing a TypeScript config file and not a JSON one. Now for some reason the type is set to a string - I thought let me try true as a string instead. Just my luck it worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants