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

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

Closed
petermlyon-zz opened this issue Oct 24, 2019 · 20 comments
Closed

Comments

@petermlyon-zz
Copy link

petermlyon-zz commented Oct 24, 2019

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
Copy link
Author

petermlyon-zz commented Oct 24, 2019

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

@petermlyon-zz
Copy link
Author

No improvement from updating to XCode 11.1

@echo-branch
Copy link
Contributor

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
Copy link
Author

petermlyon-zz commented Oct 24, 2019 via email

@petermlyon-zz
Copy link
Author

petermlyon-zz commented Oct 24, 2019

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
Copy link
Contributor

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
Copy link
Author

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

@akhudairyOP
Copy link

akhudairyOP commented Nov 5, 2019

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
Copy link

CodeWithOz commented Dec 17, 2019

@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
Copy link

rupertbear commented Dec 26, 2019

@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
Copy link

Mapiac commented Jan 7, 2020

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

@codinronan
Copy link
Contributor

@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: #613

@bobrosoft
Copy link

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

@bobrosoft
Copy link

bobrosoft commented Feb 25, 2020

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

@MehulBhanshali
Copy link

MehulBhanshali commented Jul 29, 2020

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

@bobrosoft
Copy link

bobrosoft commented Jul 29, 2020

@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
Copy link

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

@rupertbear
Copy link

@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
Copy link

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

@bobrosoft
Copy link

@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.

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

9 participants