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

4.0.0 with Cordova 9.0.0 & Cordova-ios 5.0.1 "Branch.h" not found #602

Closed petermlyon-zz closed 5 years ago

petermlyon-zz commented 5 years ago

Hi,

I've been trying to get cordova-ios with branch-cordova-sdk to build for IOS. It works fine for android (on windows) with my current setup but I get the following build error on mac while building for IOS:

Plugins/branch-cordova-sdk/BranchSDK.h:4:9: fatal error: 'Branch.h' file not
      found
#import "Branch.h"

I guess that something is failing to build branch.h, or it's a path issue?

There is an error that comes out of pod install when I run cordova plugin add branch-cordova-sdk

[!] The [Debug] target overrides the 'LD_RUNPATH_SEARCH_PATHS' build setting [!] The [Release] target overrides the 'LD_RUNPATH_SEARCH_PATHS' build setting

But I have tried manually adding $(inherited): to those paths (where they are defined in the xcconfig files) and rerunning pod install which then runs without warnings, but still got the same failure when running cordova build ios

I've also tried adding and re-adding the platform and plugin etc

petermlyon-zz commented 5 years ago

Update: I realised I am using XCode 10.3, upgrading XCode now to try again.

petermlyon-zz commented 5 years ago

No improvement from updating to XCode 11.1

echo-branch commented 5 years ago

This is a known issue due to a bug in Cordova. You must build from Xcode by opening the workspace.

Unfortunately, it would be a significant amount of effort for us to workaround it in our iOS SDK.

petermlyon-zz commented 5 years ago

I've tried doing it in XCode 10.3, I get same error.

I will try again in XCode 11.1

Get Outlook for Androidhttps://aka.ms/ghei36


From: echo-branch notifications@github.com Sent: Thursday, October 24, 2019 9:32:57 PM To: BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution cordova-ionic-phonegap-branch-deep-linking-attribution@noreply.github.com Cc: Peter Lyon peter.lyon@edge10group.com; Author author@noreply.github.com Subject: Re: [BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution] 4.0.0 with Cordova 9.0.0 & Cordova-ios 5.0.1 "Branch.h" not found (#602)

This is a known issue due to a bug in Cordova. You must build from Xcode by opening the workspace.

Unfortunately, it would be a significant amount of effort for us to workaround it in our iOS SDK.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/602?email_source=notifications&email_token=ALVFMSFXCEIW6NYZLU7ZRJTQQHS5TA5CNFSM4JEUE2J2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECGAESQ#issuecomment-546046538, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALVFMSD6KT7XTY42HLIWPRTQQHS5TANCNFSM4JEUE2JQ.

petermlyon-zz commented 5 years ago

I just tried to archive from XCode 11.1 and experienced the same issue.

#import "BranchNPM.h"

#ifdef BRANCH_NPM
#import "Branch.h"
#import "BranchLinkProperties.h"
#import "BranchUniversalObject.h"
#else

In BranchSDK.h Fails with Branch.h not file not found.

Where does Branch.h come from? I've tried looking for it but I can't find it amongst the files on my computer under any path.

My config.xml (the branch bit) like this:

    <!-- Branch -->
    <plugin name="branch-cordova-sdk" spec="^4.0.0" />
    <branch-config>
        <branch-key value="key_live_npJr5US1zSAWrlAlxDwY5oogBxgJVuIr" />
        <uri-scheme value="e10" />
        <link-domain value="e10.app.link" />
        <!-- Required app.link domain -->
        <link-domain value="e10.app.link" />
        <!-- Required alternate.app.link domain -->
        <ios-team-release value="PW4Q8885U7" />
    </branch-config>

I have npm installed branch-cordova-sdk in the CordovaApp directory of my project, and done cordova plugin add branch-cordova-sdk.

Is there some build step I could be missing?

echo-branch commented 5 years ago

Could you confirm you're opening the workspace and not the project? Cocoapods generates a workspace that includes the library as a separate project.

petermlyon-zz commented 5 years ago

Feeling stupid now as usual :) that was my issue. Thanks for your help!

akhudairyOP commented 5 years ago

This is very strange. So only solution is to build using xcode? I have also failed to solve it but I am fairly new to ios and cordova

also found new replies on this old thread from 2016 https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution/issues/18

CodeWithOz commented 4 years ago

@echo-branch I tried building from Xcode using the workspace and still got the error. I'm new to building with Xcode so I'd like to confirm that I took the right steps. In Xcode, I closed all open windows then opened MyApp.xcworkspace located in platforms/ios/. Then when it opened and the status bar showed "Ready", I clicked the Build icon. A few moments after that it failed with the same Branch.h error. Did I go wrong somewhere?

My env: Cordova cli: 8.1.2 Cordova ios: 5.1.1 Branch: 4.0.0 Pod: 1.8.4

I tried forking the Cordova ios repo and commenting out the CONFIGURATION_BUILD_DIR line per this comment but even that didn't work. :(

rupertbear commented 4 years ago

@echo-branch I tried building from Xcode using the workspace and still got the error. I'm new to building with Xcode so I'd like to confirm that I took the right steps. In Xcode, I closed all open windows then opened MyApp.xcworkspace located in platforms/ios/. Then when it opened and the status bar showed "Ready", I clicked the Build icon. A few moments after that it failed with the same Branch.h error. Did I go wrong somewhere?

My env: Cordova cli: 8.1.2 Cordova ios: 5.1.1 Branch: 4.0.0 Pod: 1.8.4

I tried forking the Cordova ios repo and commenting out the CONFIGURATION_BUILD_DIR line per this comment but even that didn't work. :(

@CodeWithOz

I tried all you did and was still having the same problem. The following worked for me in the end:

Remove any current ios platform from your project (cordova platform remove ios) Upgrade to Cordova v9 (sudo npm install -g cordova) Update Cocapods with the following couple of commands: pod repo update sudo gem install cocoapods add the ios platform back to your project Open the workspace file as you have done above and build in Xcode Note: I had to go to Signing & Capabilities section in XCode project to set the Team - you may also get an error about thi.

Other Note: I also got an error message about 'Insecure world writable dir' during the process of adding ios platform back in. If you experience the same use the following command to set appropriate permissions and re-add ios platform sudo chmod go-w /folder/listed/in/error/msg

Hope that fixes it for you!

Mapiac commented 4 years ago

Curious if anyone from Branch is active here or helping on this plugin for updates like this?

codinronan commented 4 years ago

@Mapiac indeed myself and an associate are new maintainers for these plugins, we're submitting some work today and tomorrow to address most of these issues. In fact you can check out the PR I have open that resolves this and other issues and, at least for me, seems also to resolve the cli-build issue: https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/pull/613

bobrosoft commented 4 years ago

@codinronan hi, CLI builds still fail, see #633 :(

bobrosoft commented 4 years ago

@rupertbear hey, are CLI builds working for you after all that? Or only manual Xcode builds?

MehulBhanshali commented 4 years ago

Any updates here? Still getting the same error. I am doing ionic cordova build ios --prod --release

bobrosoft commented 4 years ago

@MehulBhanshali I forked and fixed that here https://github.com/bobrosoft/cordova-ionic-phonegap-branch-deep-linking-attribution

You can use it with:

"branch-cordova-sdk": "git://github.com/bobrosoft/cordova-ionic-phonegap-branch-deep-linking-attribution.git",

However, in #633 they said that this can be solved by using CocoaPods >= 1.8.4 (I didn't try).

akhudairyOP commented 4 years ago

hi @bobrosoft .. I tried the cocoaPods version and it didn't work

rupertbear commented 4 years ago

@rupertbear hey, are CLI builds working for you after all that? Or only manual Xcode builds?

Sorry, late reply but if you mean does 'ionic cordova build ios' work after that then yes it does. Open workspace file in XCode then for final compilation/deployment

MehulBhanshali commented 4 years ago

@bobrosoft that doesn't work either. I still get branch.h file not found

bobrosoft commented 4 years ago

@MehulBhanshali you should be 100% sure that my version of the plugin installed. You should delete all temporary files, node_modules, plugins, platforms folders etc, possibly even .lock files.