cordova-ionic-phonegap-branch-deep-linking-attribution icon indicating copy to clipboard operation
cordova-ionic-phonegap-branch-deep-linking-attribution copied to clipboard

Branch.h - iOS build doesn't work

Open adrenaline15 opened this issue 5 years ago • 29 comments

Hello there, I'm also facing the issue with the missing Branch.h-File... Even tho I upgraded to the lastest cocoapods-release (1.9.1).


   Ionic CLI                     : 6.3.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.11.10
   @angular-devkit/build-angular : 0.803.25
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.25
   @ionic/angular-toolkit        : 2.1.2

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 25 other plugins)

Utility:

   cordova-res : 0.10.0
   native-run  : 0.3.0

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v10.15.3 (/usr/local/bin/node)
   npm        : 6.4.1
   OS         : macOS Mojave
   Xcode      : Xcode 11.3.1 Build version 11C505

Installed plugins:

$ cordova plugin ls
branch-cordova-sdk 4.1.2 "branch-cordova-sdk"
com.googlemaps.ios 3.5.0 "Google Maps SDK for iOS"
cordova-open-native-settings 1.5.2 "Native settings"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-customurlscheme 5.0.0 "Custom URL scheme"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-enable-multidex 0.2.0 "Enable Multidex"
cordova-plugin-firebasex 9.0.1-cli "Google Firebase Plugin"
cordova-plugin-googlemaps 2.7.0-20191107-1035 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.3 "LocalNotification"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-qrscanner-dual 3.0.1 "QRScanner"
cordova-plugin-safariviewcontroller 1.6.0 "SafariViewController"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova.plugins.diagnostic 5.0.1 "Diagnostic"
skwas-cordova-plugin-datetimepicker 2.0.0-alpha1 "DateTime picker"

I previously had installed an old cocoapods-version (1.7.2) and did now a clean update/reinstall to the newest version:

$ gem list --local | grep cocoa
cocoapods (1.9.1)
cocoapods-core (1.9.1)
cocoapods-deintegrate (1.0.4)
cocoapods-dependencies (1.3.0)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.4.1)
cocoapods-try (1.1.0)
$ pod repo list

cocoapods
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/xxx/.cocoapods/repos/cocoapods

trunk
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/xxx/.cocoapods/repos/trunk

2 repos

But if I try to build via CLI it gives me following error:

** ARCHIVE FAILED **


The following build commands failed:
        CompileC /Users/xxx/Library/Developer/Xcode/DerivedData/xxx-grzgetsogbfrvkgrgaboqjaroujn/Build/Intermediates.noindex/ArchiveIntermediates/xxx\ Ionic\ 4/IntermediateBuildFilesPath/xxx\ Ionic\ 4.build/Debug-iphoneos/xxx.build/Objects-normal/arm64/BranchSDK.o /Users/xxx/Documents/xxx/src/Applications/xxx/platforms/ios/xxx/Plugins/branch-cordova-sdk/BranchSDK.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65

-->

/Users/xxx/Documents/xxx/src/Applications/xxx/platforms/ios/xxx/Plugins/branch-cordova-sdk/BranchSDK.h:4:9: fatal error: 
      'Branch.h' file not found
#import "Branch.h"
        ^~~~~~~~~~
1 error generated.

Please let me know if you need any further information! Thanks in advance

adrenaline15 avatar Mar 23 '20 14:03 adrenaline15

I'm facing the same issue, and it happens both terminal and xCode.

Xcode: Version 11.4 (11E146)

Project dependencies:

$ ionic info

Ionic:

   Ionic CLI                     : 6.1.0 (/Users/myUser/.nvm/versions/node/v12.13.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.0
   @angular-devkit/build-angular : 0.900.1
   @angular-devkit/schematics    : 9.0.1
   @angular/cli                  : 9.0.1
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic 5.4.5, cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 14 other plugins)

Utility:

   cordova-res : 0.11.0
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (/usr/local/share/android-sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.2
   NodeJS            : v12.13.0 (/Users/myUser/.nvm/versions/node/v12.13.0/bin/node)
   npm               : 6.12.0
   OS                : macOS Catalina
   Xcode             : Xcode 11.4 Build version 11E146

Installed plugins:

> cordova plugin ls
branch-cordova-sdk 4.1.2 "branch-cordova-sdk"
cordova-annotated-plugin-android 1.0.4 "cordova-annotated-plugin-android"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-facebook4 6.3.0 "Facebook Connect"
cordova-plugin-firebasex 8.1.1 "Google Firebase Plugin"
cordova-plugin-health 1.1.3 "Cordova Health"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic 5.4.5 "cordova-plugin-ionic"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-purchases 1.0.5 "Purchases"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"

Build output:

ionic cordova build ios
In file included from /Users/myUser/Projects/myProject/ionic4/platforms/ios/myProject/Plugins/branch-cordova-sdk/BranchSDK.m:1:
/Users/myUser/Projects/myProject/ionic4/platforms/ios/myProject/Plugins/branch-cordova-sdk/BranchSDK.h:4:9: fatal error: 'Branch.h' file not found
#import "Branch.h"
        ^~~~~~~~~~
1 error generated.

...

warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'Branch' from project 'Pods')
** ARCHIVE FAILED **


The following build commands failed:
	CompileC /Users/myUser/Library/Developer/Xcode/DerivedData/myProject-aoynxopuapcojndwtqkcbsfscfqw/Build/Intermediates.noindex/ArchiveIntermediates/myProject/IntermediateBuildFilesPath/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/BranchSDK.o /Users/myUser/Projects/myProject/ionic4/platforms/ios/myProject/Plugins/branch-cordova-sdk/BranchSDK.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Command finished with error code 65: xcodebuild -workspace,myProject.xcworkspace,-scheme,myProject,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,myProject.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/myUser/Projects/myProject/ionic4/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/myUser/Projects/myProject/ionic4/platforms/ios/build/sharedpch
xcodebuild: Command failed with exit code 65
Error: xcodebuild: Command failed with exit code 65
    at ChildProcess.whenDone (/Users/myUser/Projects/mighty/ionic4/node_modules/cordova-common/src/superspawn.js:135:23)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[ERROR] An error occurred while running subprocess cordova.

Cocoapods:

cocoapods-1.9.1

felipeclopes avatar Mar 31 '20 23:03 felipeclopes

The issue was happening in my end due to opening the project not the workspace in Xcode.

It is fixed now!

felipeclopes avatar Apr 01 '20 20:04 felipeclopes

The issue was happening in my end due to opening the project not the workspace in Xcode. It is fixed now!

You are absolutely right, if I'm opening the workspace (since the pods/dependent stuff get also imported via xcodeworkspace-file) in xcode I can build the project successfully; but thats not a suitable solution for me..

I would like to automate the building process without any necessary GUI-interaction. (aka via CLI)

adrenaline15 avatar Apr 02 '20 09:04 adrenaline15

Our process is fully automated, the only steps we do have in our CI, is to make sure we have an updated enough pods gem and pods. The CI run pod repo update and pod install on the platform specific folder, before building it.

felipeclopes avatar Apr 02 '20 16:04 felipeclopes

I have the same issue with version 4.1.3 and ionic 3 when building for IOS. I can build using xcode and that is fine but I can't use ionic run with livereload because the build error kill the live reload server. This is slowing down the our development process a lot. Can't even go back to plugin 3X due to the UIWebView and apple rejection problem (ITMS-90809). Is this going to be fixed in a new release or is there a workaround? Thanks

AleCat83 avatar May 08 '20 15:05 AleCat83

I have the same issue with version 4.1.3 and ionic 3 when building for IOS. I can build using xcode and that is fine but I can't use ionic run with livereload because the build error kill the live reload server. This is slowing down the our development process a lot. Can't even go back to plugin 3X due to the UIWebView and apple rejection problem (ITMS-90809). Is this going to be fixed in a new release or is there a workaround? Thanks

I am facing the same problem using ionic 4. I also cannot go back to version 3.x of the plugin for the same reason as the depreciation of the UIWebView usage. I'm waiting for a correction.

sysmo-dsv avatar May 22 '20 19:05 sysmo-dsv

Hello. I found a solution for this error. I'm using Ionic 4.x and Xcode 11.4.1.

I removed the plugins folder: rm -rf plugins/

I installed/updated the following versions: npm i @ionic-cli@latest

ionic cordova plugin rm branch-cordova-sdk ionic cordova plugin add [email protected] npm i @ionic-native/[email protected]

ionic cordova plugin rm cordova-open-native-settings ionic cordova plugin add [email protected] npm i @ionic-native/[email protected]

I reinstalled the ios platform: ionic cordova platform rm ios ionic cordova platform add [email protected]

Before executing the build command, I did the following procedures:

  • I opened the .xcworkspace file on platforms/ios/ folder;
  • I opened the "Build Settings" tab;
  • I searched for "Header Search Paths" and added the following paths in debug and release configuration: "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK" "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK/Networking"

With these procedures the build is successful and I no longer have the issue ITMS-90809 (UIWebView usage) when uploading my application. Hope this helps.

SidiBecker avatar May 24 '20 02:05 SidiBecker

Hello. I found a solution for this error. I'm using Ionic 4.x and Xcode 11.4.1.

I removed the plugins folder: rm -rf plugins/

I installed/updated the following versions: npm i @ionic-cli@latest

ionic cordova plugin rm branch-cordova-sdk ionic cordova plugin add [email protected] npm i @ionic-native/[email protected]

ionic cordova plugin rm cordova-open-native-settings ionic cordova plugin add [email protected] npm i @ionic-native/[email protected]

I reinstalled the ios platform: ionic cordova platform rm ios ionic cordova platform add [email protected]

Before executing the build command, I did the following procedures:

  • I opened the .xcworkspace file on platforms/ios/ folder;
  • I opened the "Build Settings" tab;
  • I searched for "Header Search Paths" and added the following paths in debug and release configuration: "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK" "${PODS_ROOT}/Branch/Branch-SDK/Branch-SDK/Networking"

With these procedures the build is successful and I no longer have the issue ITMS-90809 (UIWebView usage) when uploading my application. Hope this helps.

Works for me! Thanks!

sysmo-dsv avatar May 24 '20 14:05 sysmo-dsv

Thanks @SidiBecker ! Actually the search headers are the only thing we needed to get this working.

I've created a hook which can be added to your Ionic project which will fix (workaround) the issue by adding these 2 header search paths automatically: https://gist.github.com/Sroose/d3db4178babbab1b39b68e9889e7869b

@ Branch team, I think this should be fixed in the Pod?

Sroose avatar May 26 '20 11:05 Sroose

Wonderful automation @Sroose. Thanks!

SidiBecker avatar May 26 '20 11:05 SidiBecker

Any update from the Branch team? I'm stuck on v3.4.0 because of this issue

noahcooper avatar Jun 25 '20 20:06 noahcooper

any news?

jffs avatar Jun 26 '20 13:06 jffs

Hey @adrenaline15 and @felipeclopes please refer to https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/604#issuecomment-558997030

I have tried to reproduce this issue with a fresh ionic install but it's building and running fine. Branch is usually the first plugin and/or Pod. I quote the following text from the same issue linked above

any build error in any pod will also cause it (because Branch is usually the first Pod, so it will come first alphabetically after the main project attempts to resolve Pod dependencies)

If you still have the same issue after this, please provide a minimal reproducible case.

adrianyg7 avatar Jun 29 '20 19:06 adrianyg7

This can be reproduced by using branch-cordova-sdk along with cordova-plugin-facebook4 (as in the original description provided by @adrenaline15). If cordova-plugin-facebook4 is not included, the build succeeds.

noahcooper avatar Jul 01 '20 04:07 noahcooper

how we can fix it if have to use facebook plugin?

jffs avatar Jul 01 '20 23:07 jffs

Here is a PR that will help with this https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/pull/660 while this gets merged and released you can add the hook @Sroose shared above. (Thanks @sysmo-dsv for the contribution)

Please note that some plugins still use the old CocoaPods way to resolve config dirs or other obscure ways that modify CocoaPods config causing other plugins to fail, since Branch is usually the first pod alphabetically, it'll show up as the error when attempting to build the main project.

adrianyg7 avatar Jul 06 '20 23:07 adrianyg7

Branch team, any thoughts on when the fix for this will be released?

noahcooper avatar Aug 16 '20 15:08 noahcooper

Sorry for the delay. There's some iOS 14 related work that we'd like to include with the next release and choose to delay a bit.

echo-branch avatar Aug 17 '20 15:08 echo-branch

Version 4.2.0 of this plugin still fails when cordova-plugin-facebook4 is used.

noahcooper avatar Aug 30 '20 01:08 noahcooper

@echo-branch : We are not able to build an iOS build when we use your plugin. This is a work stoppage. Any ideas when this will get released - I am talking about the Branch.h file not found error

gopi-hl avatar Aug 31 '20 09:08 gopi-hl

We still have issues building our app with the 4.2.0 :

[...]/branch-cordova-sdk/BranchSDK.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[cordova] (1 failure)
[cordova] xcodebuild: Command failed with exit code 65

It seems there is a conflict with cordova-plugin-googleplus: 8.5.0

mvaullerin avatar Sep 01 '20 07:09 mvaullerin

Any update from the Branch team? Version 4 of this plugin has been broken for 6 months now. With upcoming iOS changes, it'll be important for all developers to move off of version 3.

noahcooper avatar Sep 01 '20 13:09 noahcooper

Anything?

noahcooper avatar Sep 14 '20 13:09 noahcooper

@noahcooper We believe the issue is plugin compatibility.

We have a potential fix on staging, which is waiting on an iOS patch release. You could try pointing there to see if it resolves the issue.

It would be pretty helpful if you could share what other 3rd party plugins you're using.

echo-branch avatar Sep 14 '20 16:09 echo-branch

@echo-branch I'm encountering this issue when using this plugin with the cordova-plugin-facebook4 plugin.

noahcooper avatar Sep 14 '20 17:09 noahcooper

Any chance of a release of this plugin sometime soon with the fix for this issue?

noahcooper avatar Nov 06 '20 01:11 noahcooper

@noahcooper sorry about that, i totally dropped the ball on this patch release. Getting it out now.

echo-branch avatar Nov 06 '20 19:11 echo-branch

Yay, my build is working again. Thanks, Branch team!

noahcooper avatar Nov 07 '20 03:11 noahcooper

No it is not working for me. Still getting the same issue while build the app

tamsel12 avatar Feb 13 '21 11:02 tamsel12