BranchMetrics / cordova-ionic-phonegap-branch-deep-linking-attribution

The Branch Cordova Ionic Phonegap SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/cordova-phonegap-ionic/
MIT License
234 stars 144 forks source link

Legacy ionic 3 app build problems with branch-cordova-sdk #654

Open newuser44 opened 4 years ago

newuser44 commented 4 years ago

Been having this problem for weeks now.
A legacy app that is on ionic 3. Have updated to cordova iOS 5. Could be other programs that our outdated too? Been trying to get things to build with

Trying to do fresh set up.

cordova platform add ios@5
Using cordova-fetch for cordova-ios@5
Adding ios project...
Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: com.app-MWA-Carrier.test
    Name: CarrierControl
iOS project created with cordova-ios@5.1.1
Installing "branch-cordova-sdk" for ios
Failed to install 'branch-cordova-sdk': Error: Cannot find module 'xml2js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /Users/sbrothers/work/appRelease/mobileapps/carrier-control/plugins/branch-cordova-sdk/src/scripts/lib/xmlHelper.js:5:18

Each time I try something else I get a different error. I'll keep posting what I find. I think my next step is to remove branch.

UPDATE Remove branch plugin, can get iOS to build. Things are working correctly.
Add to config.xml

Build again different error.

cordova build ios --buildFlag=-UseModernBuildSystem=0
Discovered plugin "branch-cordova-sdk" in config.xml. Adding it to the project
Installing "branch-cordova-sdk" for browser
Installing "branch-cordova-sdk" for ios
Failed to install 'branch-cordova-sdk': Error: Cannot find module './src/superspawn'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at Object.get (/Users/sbrothers/work/appRelease/mobileapps/node_modules/cordova-common/src/util/addProperty.js:26:44)
    at Object.<anonymous> (/Users/sbrothers/work/appRelease/mobileapps/carrier-control/platforms/ios/cordova/lib/Podfile.js:26:43)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
Failed to restore plugin "branch-cordova-sdk" from config.xml. You might need to try adding it again. Error: Error: Cannot find module './src/superspawn'

The plugin does show up in the plugin folder.
Try to build again.

Building for DIT
> ionic-app-scripts build --prod --target cordova --platform ios --buildFlag=-UseModernBuildSystem=0
module.js:549
    throw err;
    ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)

Build is all screwed up. Have to start over adding and removing iOS to fix this.

What is going on?

Update again.
Add and remove Branch plugin from command line. Got error below. Even tried it all again using the @4 flag. I think both times its downloading the latest.

Do my build. Getting this in the log

/Users/sbrothers/work/appRelease/mobileapps/carrier-control/platforms/ios/ CarrierControl/Plugins/branch-cordova-sdk/AppDelegate+BranchSdk.m:6:9: fatal error: 
      'Branch.h' file not found
#import "Branch.h"
        ^~~~~~~~~~
1 error generated.
Sroose commented 4 years ago

Same here on Ionic4

In file included from xxx/Plugins/branch-cordova-sdk/BranchSDK.m:1:
xxx/Plugins/branch-cordova-sdk/BranchSDK.h:4:9: fatal error: 'Branch.h' file not found
#import "Branch.h"
        ^~~~~~~~~~
1 error generated.
newuser44 commented 4 years ago

Any update? Getting the same problem and searching the web for a solution. Google brings me back to my own problem from months ago.

Adding platfrom iOS auto address all the plugins which seems to cause a problem for Branch io.
Please advice?

Sroose commented 4 years ago

Duplicate of https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/642 @newuser44 you can find my workaround there