nordnet / cordova-universal-links-plugin

[DEPRECATED] - Cordova plugin to support Universal/Deep Links for iOS/Android.
https://github.com/nordnet/cordova-universal-links-plugin/issues/160
MIT License
349 stars 529 forks source link

Error: Cannot find module '../plugman/platforms/ios'. Deprecated code in xcodePreferences.js after upgrading to Cordova 7.0.0 #110

Closed MarsupiL closed 5 years ago

MarsupiL commented 7 years ago

See https://github.com/driftyco/ionic-plugin-deeplinks/issues/99 The fix suggested by peterpeterparker seems to work but a more permanent solution with a plugin update would be appreciated. Thanks for the support.

lovelyelfpop commented 7 years ago
function loadProjectFile() {
var platform_ios;
var projectFile;

try {
    // try pre-5.0 cordova structure
    platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms')['ios'];
    projectFile = platform_ios.parseProjectFile(iosPlatformPath());
} catch (e) {
    try {
        // let's try cordova 5.0 structure
        platform_ios = context.requireCordovaModule('cordova-lib/src/plugman/platforms/ios');
        projectFile = platform_ios.parseProjectFile(iosPlatformPath());
    } catch (e) {
        // Then cordova 7.0
        var project_files = context.requireCordovaModule('glob').sync(path.join(iosPlatformPath(), '*.xcodeproj', 'project.pbxproj'));

        if (project_files.length === 0) {
            throw new Error('does not appear to be an xcode project (no xcode project file)');
        }

        var pbxPath = project_files[0];

        var xcodeproj = context.requireCordovaModule('xcode').project(pbxPath);
        xcodeproj.parseSync();

        projectFile = {
            'xcode': xcodeproj,
            write: function () {
                var fs = context.requireCordovaModule('fs');

            var frameworks_file = path.join(iosPlatformPath(), 'frameworks.json');
            var frameworks = {};
            try {
                frameworks = context.requireCordovaModule(frameworks_file);
            } catch (e) { }

            fs.writeFileSync(pbxPath, xcodeproj.writeSync());
                if (Object.keys(frameworks).length === 0){
                    // If there is no framework references remain in the project, just remove this file
                    context.requireCordovaModule('shelljs').rm('-rf', frameworks_file);
                    return;
                }
                fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4));
            }
        };
    }
}

return projectFile;
} 
meermedia commented 7 years ago

@lovelyelfpop 's solution worked for me, thank you!

mikegleasonjr commented 7 years ago

May I suggest the title contains at least the error encountered: Error: Cannot find module '../plugman/platforms/ios'. I found driftyco/ionic-plugin-deeplinks#99 before this one, even though I search the issue here first.

alexnu commented 7 years ago

Hi, this fix works as a temporary solution but is it going to be fixed on npm too ?

mikegleasonjr commented 7 years ago

Still not fixed, this is quite a pain to edit this function every time I install dependencies

hrangel commented 7 years ago

Can this be merged?

velochy commented 7 years ago

Why has this not been merged in 2 months? Is there a good reason?

jespertheend commented 6 years ago

Any updates on this?

mikegleasonjr commented 6 years ago

Hellooooooo? there are even forks that have the fix: https://github.com/flipflopapp/cordova-universal-links-plugin

gvsrepins commented 6 years ago

Hy guys, any plans to update it? Or should we use the fork already?

jespertheend commented 6 years ago

The latest commit was on January 29th and there doesn't seem to be much activity from @nikDemyankov so I've got the feeling this repository has been abandoned.

florgb02 commented 6 years ago

Any Plans on merging this fix?

santiDotIO commented 6 years ago

Any chance this will get merged soon?

cloudmanic commented 6 years ago

It would be amazing if this could get merged soon. Thanks!

jespertheend commented 6 years ago

This repository appears to be abandoned so your best option is to just use one of the forks mentioned in this thread.

elgindavis commented 6 years ago

I had the same issue with cordova 8.0 and was able to resolve this by reverting to cordova@6.5 --npm i cordova@6.5

caleb87 commented 6 years ago

The code provided by lovelyelfpop throws an error when returning from a webview out of the app ("Return to App name..." in top-left) .

InvalidCharacterError: The string contains invalid characters.

Any idea how to fix?

travisdahl commented 6 years ago

Also curious when an official fix will be merged... Official firebase docs reference this plugin as a dependency, le sigh. https://firebase.google.com/docs/auth/web/cordova

nordnet-deprecation-bot commented 5 years ago

👋 Hi! Thank you for your interest in this repo.

đŸ˜ĸ We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹī¸ Please see #160 for more information.