Skip to content
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

LD_RUNPATH_SEARCH_PATHS.substr is not a function #344

Closed
Fever905 opened this issue Mar 18, 2020 · 33 comments
Closed

LD_RUNPATH_SEARCH_PATHS.substr is not a function #344

Fever905 opened this issue Mar 18, 2020 · 33 comments
Labels
bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform

Comments

@Fever905
Copy link

Have been getting this error when I try to build with CLI. i am using the new -cli version from the other issue. This was doing this on the previous version as well however.

cordova build --device --debugu
cordova-plugin-firebasex: Preparing Firebase on iOS
LD_RUNPATH_SEARCH_PATHS.substr is not a function

Not sure what this is about.

@Fever905
Copy link
Author

Removed platform ios and re-added
cd platforms/ios
pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 9 dependencies from the Podfile and 34 total pods installed.

[!] The Oil Analysis [Debug] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-Oil Analysis/Pods-Oil Analysis.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
- Remove the build settings from the target.

[!] The Oil Analysis [Release] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-Oil Analysis/Pods-Oil Analysis.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
- Remove the build settings from the target.
wc-mavic:ios michaeldemutis$

@dpa99c dpa99c added the support Support is being requested but not a necessarily a bug label Mar 18, 2020
@dpa99c
Copy link
Owner

dpa99c commented Mar 18, 2020

Ah, wait yes I can see that it does

@Fever905
Copy link
Author

I removed platform ios and re-added and it seems to be ok now. Can also build from cli no problem. I'm using cordova ios 5.1.1. Not sure if that is the latest version but that's what it installed.

@dpa99c dpa99c added the investigate Issue requires investigation label Mar 18, 2020
@dpa99c
Copy link
Owner

dpa99c commented Mar 18, 2020

I will have a look and see if I can see the cause

@Fever905
Copy link
Author

It's building fine from cli now so not sure what was happening. Removing the ios platform then re-adding seems to work.

@dpa99c
Copy link
Owner

dpa99c commented Mar 23, 2020

I can't reproduce this issue so will close this for now but if you encounter it again let me know

@dpa99c dpa99c closed this as completed Mar 23, 2020
@wnabil
Copy link

wnabil commented Jun 2, 2020

Its an issue with platform cordova-ios v6, removing and adding the platform as 5.1.1 fixes the issue
cordova platform remove ios
cordova platform add ios@5.1.1

@yoginm
Copy link

yoginm commented Jun 5, 2020

this is what i see.
cordova-ios v5.1.0 returns a string for LD_RUNPATH_SEARCH_PATHS as
"@executable_path/Frameworks"

cordova-ios v6.0.0 returns an array of string now as
"@executable_path/Frameworks","$(inherited)"

The following function expected this variable to be a string and hence the substr failed. Modifying the following function in file /plugins/cordova-plugin-firebasex/scripts/ios/helper.js fixes it.

function addRunpathSearchBuildProperty(proj, build) {
const LD_RUNPATH_SEARCH_PATHS = proj.getBuildProperty("LD_RUNPATH_SEARCH_PATHS", build);
if (!LD_RUNPATH_SEARCH_PATHS) {
proj.addBuildProperty("LD_RUNPATH_SEARCH_PATHS", ""$(inherited) @executable_path/Frameworks"", build);
}
// Following code is to handle arrays.
if (Array.isArray(LD_RUNPATH_SEARCH_PATHS)) {
LD_RUNPATH_SEARCH_PATHS.forEach(eachpath => {
if (eachpath.indexOf("@executable_path/Frameworks") == -1) {
var newValue = eachpath.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1);
newValue += ' @executable_path/Frameworks"';
proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build);
}
if (eachpath.indexOf("$(inherited)") == -1) {
var newValue = eachpath.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1);
newValue += ' $(inherited)"';
proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build);
}
});
}
else{
// Assuming is a string
if (LD_RUNPATH_SEARCH_PATHS.indexOf("@executable_path/Frameworks") == -1) {
var newValue = LD_RUNPATH_SEARCH_PATHS.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1);
newValue += ' @executable_path/Frameworks"';
proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build);
}
if (LD_RUNPATH_SEARCH_PATHS.indexOf("$(inherited)") == -1) {
var newValue = LD_RUNPATH_SEARCH_PATHS.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1);
newValue += ' $(inherited)"';
proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build);
}
}
}

@dpa99c
Copy link
Owner

dpa99c commented Jun 7, 2020

I can repro this with cordova-ios@6.0.0

@dpa99c dpa99c reopened this Jun 7, 2020
@dpa99c dpa99c added bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform and removed investigate Issue requires investigation support Support is being requested but not a necessarily a bug labels Jun 7, 2020
@dpa99c dpa99c closed this as completed in 4e6920f Jun 7, 2020
@dpa99c dpa99c added the ready for release Something has been implemented and is awaiting release to npm label Jun 7, 2020
dpa99c pushed a commit that referenced this issue Jun 10, 2020
@vladsms
Copy link

vladsms commented Aug 3, 2020

I still have this issue with cordova-plugin-firebasex@10.1.2-cli and cordova-ios@6.1.0
The project can be built only once after platform adding and the next time it gives this error "LD_RUNPATH_SEARCH_PATHS.substr is not a function".

@wnabil
Copy link

wnabil commented Aug 25, 2020

@vladsms use cordova ios 5.1.1

@toxaq
Copy link

toxaq commented Sep 5, 2020

Has this been released? I'm in dependency hell at the moment.

@dreamsecurity
Copy link

@vladsms use cordova ios 5.1.1
I am using iOS 5.1.1 platform, but I still have this problem ... I am using cordova 10.0 Plugin version cordova-plugin-firebasex@10.1.2-cli, tried iOS 5.1.1, 5.1.0, 5.0.0, 6.1. 1, 6.1.0, 6.0.0 - everywhere the same problem (((

@vladsms
Copy link

vladsms commented Sep 9, 2020

@vladsms use cordova ios 5.1.1
I am using iOS 5.1.1 platform, but I still have this problem ... I am using cordova 10.0 Plugin version cordova-plugin-firebasex@10.1.2-cli, tried iOS 5.1.1, 5.1.0, 5.0.0, 6.1. 1, 6.1.0, 6.0.0 - everywhere the same problem (((

I had to downgrade to "cordova-plugin-firebasex@9.1.2-cli" due to another android issue, but this LD_RUNPATH_SEARCH_PATHS is still there and I simply live with it. Maybe even earlier version can do the job? Did you try 8.x.x?

@toxaq
Copy link

toxaq commented Sep 10, 2020

Switching to capacitor resolved the issue for me. I could not workout why downgrading cordova-ios did not work.

@jh-gh
Copy link

jh-gh commented Sep 10, 2020

@toxaq Have you been able to use this plugin successfully with capacitor? Does your app use push notifications? I was under the impression that this plugin does not work with capacitor (at least for push notifications).

@toxaq
Copy link

toxaq commented Sep 10, 2020

@jh-gh no, I just pulled the whole thing and use the capacitor push notifications plugin. That was all I was using functionality wise. I spent less time rewriting than I did trying every variation of versions to never succeed in getting this to compile.

@jh-gh
Copy link

jh-gh commented Sep 10, 2020

@toxaq Thanks for the reply. I may have to do something similar at some point if I move to capacitor. However I would prefer to keep using this awesome plugin if possible as it has great features and incredible support ... just not for capacitor unfortunately at this point.

@dpa99c dpa99c removed the ready for release Something has been implemented and is awaiting release to npm label Sep 15, 2020
@ChiragPrajapat
Copy link

i am getting this build issue :
ionic: 5
cordova-ios: 6.0.0
cordova : 9.0.0
cordova-plugin-firebasex: 11.0.2,

Preparing Firebase on iOS
LD_RUNPATH_SEARCH_PATHS.substr is not a function

@Crypt0Graphic
Copy link

You folks don't like this answer but problem is cordova-ios 6.x.x as mentioned above.

I spent hours on this error with Cordova (9 & 10) FirebaseX (8.0.1 & 11.0.3) but couldn't find another solution. Including XCode build settings. First i suspected Cordova 10 but no it's just about cordova-ios version. 5.1.1 works well.

ionic cordova platform add ios@5.1.1

@lifox89
Copy link

lifox89 commented Oct 28, 2020

Man, indeed downgrading to 5.1.1 saved me. Been on this issue for 2 days already, nothing worked except this.

@tomavic
Copy link

tomavic commented Nov 14, 2020

@lifox89 I am in the need to use cordova@6.1.1 as APP STORE is keep rejecting my app because existence of something called "UIWebView". This soliton is a suggested solution in this discussion

@tomavic
Copy link

tomavic commented Nov 14, 2020

@Crypt0Graphic I am just doing like you right now!

I am doing math and trying to mix versions numbers with each other to get a successful build to the APPLE STORE!!

@tomavic
Copy link

tomavic commented Nov 14, 2020

Here is what WORKED FOR ME.

You just open XCode and build the app from it. That's it !!

You can also Archive and Validate the app.

@lifox89
Copy link

lifox89 commented Nov 16, 2020

@lifox89 I am in the need to use cordova@6.1.1 as APP STORE is keep rejecting my app because existence of something called "UIWebView". This soliton is a suggested solution in this discussion

5.1.1 uses the new WKWebView you just had to put in the config.xml explicitly.

This way when it builds, it will force to use the new wkwebview. I always make sure that I build prod from the ionic cli, so that I won't miss anything. Incomplete build from ionic cli might leave something that is needed, and the app might not work properly in produciton.

@tomavic
Copy link

tomavic commented Nov 16, 2020

@lifox89

Here is sample of my config.xml

image

I don't know what's wrong!! I've uploaded 8 apps to store till now and they are all rejected!!

@tomavic
Copy link

tomavic commented Nov 20, 2020

Trying cordova@5 or 6 with cordova 9 or 10 didn't help, although all of suspicions plugins have been updated to latest versions as suggested from the fellas.

@Crypt0Graphic
Copy link

Crypt0Graphic commented Nov 23, 2020

@lifox89 I am in the need to use cordova@6.1.1 as APP STORE is keep rejecting my app because existence of something called "UIWebView". This soliton is a suggested solution in this discussion

UIWebView is another issue:

The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

I use that preference under ios section for cordova-ios 5.1.1. No problem with App Store:

<platform name="ios">
<preference name="WKWebViewOnly" value="true" />

More Info: https://ionicframework.com/blog/understanding-itms-90809-uiwebview-api-deprecation/

@tomavic
Copy link

tomavic commented Dec 19, 2020

@lifox89 I am in the need to use cordova@6.1.1 as APP STORE is keep rejecting my app because existence of something called "UIWebView". This soliton is a suggested solution in this discussion

UIWebView is another issue:

The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

I use that preference under ios section for cordova-ios 5.1.1. No problem with App Store:

<platform name="ios">
<preference name="WKWebViewOnly" value="true" />

More Info: https://ionicframework.com/blog/understanding-itms-90809-uiwebview-api-deprecation/

Hello @Crypt0Graphic

Maybe because your app is already on the store. Actually this is a first time app. Believe me I've tried many stuff. I ended up migrating to another framework :(

@Crypt0Graphic
Copy link

Hello @Crypt0Graphic

Maybe because your app is already on the store. Actually this is a first time app. Believe me I've tried many stuff. I ended up migrating to another framework :(

I uploaded a new app in April '20. I remember i got a similar error and solved as i said. Btw December '20 is last date for existing apps. We will see if it's a valid solution soon.

@tomavic
Copy link

tomavic commented Jan 8, 2021

It's 2021! any tries with App Store yet. xD

@Crypt0Graphic
Copy link

It's 2021! any tries with App Store yet. xD

Anymore new or existing apps are in same situation and i published a new version of existing app in 2021 without problem. Solution seems ok.

@mirinnes
Copy link

mirinnes commented Apr 19, 2022

this is what i see. cordova-ios v5.1.0 returns a string for LD_RUNPATH_SEARCH_PATHS as "@executable_path/Frameworks"

cordova-ios v6.0.0 returns an array of string now as "@executable_path/Frameworks","$(inherited)"

The following function expected this variable to be a string and hence the substr failed. Modifying the following function in file /plugins/cordova-plugin-firebasex/scripts/ios/helper.js fixes it.

function addRunpathSearchBuildProperty(proj, build) { const LD_RUNPATH_SEARCH_PATHS = proj.getBuildProperty("LD_RUNPATH_SEARCH_PATHS", build); if (!LD_RUNPATH_SEARCH_PATHS) { proj.addBuildProperty("LD_RUNPATH_SEARCH_PATHS", ""$(inherited) @executable_path/Frameworks"", build); } // Following code is to handle arrays. if (Array.isArray(LD_RUNPATH_SEARCH_PATHS)) { LD_RUNPATH_SEARCH_PATHS.forEach(eachpath => { if (eachpath.indexOf("@executable_path/Frameworks") == -1) { var newValue = eachpath.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1); newValue += ' @executable_path/Frameworks"'; proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build); } if (eachpath.indexOf("$(inherited)") == -1) { var newValue = eachpath.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1); newValue += ' $(inherited)"'; proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build); } }); } else{ // Assuming is a string if (LD_RUNPATH_SEARCH_PATHS.indexOf("@executable_path/Frameworks") == -1) { var newValue = LD_RUNPATH_SEARCH_PATHS.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1); newValue += ' @executable_path/Frameworks"'; proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build); } if (LD_RUNPATH_SEARCH_PATHS.indexOf("$(inherited)") == -1) { var newValue = LD_RUNPATH_SEARCH_PATHS.substr(0, LD_RUNPATH_SEARCH_PATHS.length - 1); newValue += ' $(inherited)"'; proj.updateBuildProperty("LD_RUNPATH_SEARCH_PATHS", newValue, build); } } }

The function needed some adjustments but worked
The "clean" function I used was:

function addRunpathSearchBuildProperty(proj, build) {
            const LD_RUNPATH_SEARCH_PATHS = proj.getBuildProperty(
                'LD_RUNPATH_SEARCH_PATHS',
                build
            )
            if (!LD_RUNPATH_SEARCH_PATHS) {
                proj.addBuildProperty(
                    'LD_RUNPATH_SEARCH_PATHS',
                    '$(inherited) @executable_path/Frameworks',
                    build
                )
            }
            // Following code is to handle arrays.
            if (Array.isArray(LD_RUNPATH_SEARCH_PATHS)) {
                var newValue
                LD_RUNPATH_SEARCH_PATHS.forEach(eachpath => {
                    if (
                        eachpath.indexOf('@executable_path/Frameworks') === -1
                    ) {
                        newValue = eachpath.substr(
                            0,
                            LD_RUNPATH_SEARCH_PATHS.length - 1
                        )
                        newValue += ' @executable_path/Frameworks"'
                        proj.updateBuildProperty(
                            'LD_RUNPATH_SEARCH_PATHS',
                            newValue,
                            build
                        )
                    }
                    if (eachpath.indexOf('$(inherited)') === -1) {
                        newValue = eachpath.substr(
                            0,
                            LD_RUNPATH_SEARCH_PATHS.length - 1
                        )
                        newValue += ' $(inherited)"'
                        proj.updateBuildProperty(
                            'LD_RUNPATH_SEARCH_PATHS',
                            newValue,
                            build
                        )
                    }
                })
            } else {
                // Assuming is a string
                if (
                    LD_RUNPATH_SEARCH_PATHS.indexOf(
                        '@executable_path/Frameworks'
                    ) === -1
                ) {
                    newValue = LD_RUNPATH_SEARCH_PATHS.substr(
                        0,
                        LD_RUNPATH_SEARCH_PATHS.length - 1
                    )
                    newValue += ' @executable_path/Frameworks"'
                    proj.updateBuildProperty(
                        'LD_RUNPATH_SEARCH_PATHS',
                        newValue,
                        build
                    )
                }
                if (LD_RUNPATH_SEARCH_PATHS.indexOf('$(inherited)') === -1) {
                    newValue = LD_RUNPATH_SEARCH_PATHS.substr(
                        0,
                        LD_RUNPATH_SEARCH_PATHS.length - 1
                    )
                    newValue += ' $(inherited)"'
                    proj.updateBuildProperty(
                        'LD_RUNPATH_SEARCH_PATHS',
                        newValue,
                        build
                    )
                }
            }
        }

I preserved cordova ios 6.2.0 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly build issue An issue related to build process ios relates to iOS platform
Projects
None yet
Development

No branches or pull requests