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

BranchSDK not found #356

Closed
amovsesy opened this issue Aug 16, 2017 · 15 comments
Closed

BranchSDK not found #356

amovsesy opened this issue Aug 16, 2017 · 15 comments

Comments

@amovsesy
Copy link

I recently updated to the latest branch sdk and now none of my branch links work. As I was playing with it I got the following error in xcode:

2017-08-16 20:49:23.238643+0200 Zently[3020:1033056] CDVPlugin class BranchSDK (pluginName: BranchSDK) does not exist.
2017-08-16 20:49:23.238727+0200 Zently[3020:1033056] ERROR: Plugin 'BranchSDK' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2017-08-16 20:49:23.238820+0200 Zently[3020:1033056] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["BranchSDK1637249983","BranchSDK","initSession",[]]

@ethanneff
Copy link
Contributor

Hello,

Depending on how old your last version of the Cordova Branch SDK, you might need to follow this guide to reinstall Branch (we had an SDK package name rename last year).

Thanks,

@amovsesy
Copy link
Author

amovsesy commented Aug 16, 2017

Thanks for the reply @ethanneff, I did all these steps. Everything compiles great and it builds, but when I deploy my app to my phone I see the errors above. Before I get those errors I see the following on startup in the console of xcode:
017-08-16 21:18:55.440528+0200 Zently[3076:1044851] CDVPlugin class BranchSDK (pluginName: branchsdk) does not exist.
2017-08-16 21:18:55.440548+0200 Zently[3076:1044851] [CDVTimer][branchsdk] 0.038981ms

in config.xml:
<plugin name="branch-cordova-sdk" spec="^2.6.0" />
<branch-config>
<branch-key value="key_live_FFFFF" />
<uri-scheme value="urischeme" />
<link-domain value="domain.link" />
<ios-team-release value="AAAAAAAAA" />
</branch-config>

Here is a list of my plugins:
branch-cordova-sdk 2.6.7 "branch-cordova-sdk"
com.instabug.cordova.plugin 1.0.0 "instabug-cordova"
com.synconset.imagepicker 2.1.7-zently "ImagePicker"
cordova-custom-config 3.1.2 "cordova-custom-config"
cordova-fabric-plugin 1.1.5 "cordova-fabric-plugin"
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-apprate 1.3.0 "AppRate"
cordova-plugin-badge 0.7.4 "Badges"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-cocoapod-support 1.3.0 "Cordova CocoaPods Dependency Support"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-contacts 2.2.1 "Contacts"
cordova-plugin-dialogs 1.3.1 "Notification"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-file 4.2.0 "File"
cordova-plugin-file-transfer 1.6.4-zently "File Transfer"
cordova-plugin-geolocation 2.4.2 "Geolocation"
cordova-plugin-globalization 1.0.7 "Globalization"
cordova-plugin-google-analytics 1.7.4 "Google Universal Analytics Plugin"
cordova-plugin-ignore-lint-translation 0.0.1 "cordova-plugin-ignore-lint-translation"
cordova-plugin-inappbrowser 1.6.1 "InAppBrowser"
cordova-plugin-ios-no-export-compliance 0.0.1 "iOS No Export Compliance"
cordova-plugin-media-capture 1.4.1 "Capture"
cordova-plugin-segment 0.0.2-zently "AnalyticsPlugin"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova-plugin-x-toast 2.6.0 "Toast"
cordova-sqlite-storage 2.0.1 "Cordova sqlite storage plugin"
es6-promise-plugin 3.0.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
me.tonny.cordova.plugins.multidex 0.1.0 "Cordova Multi Dex"
phonegap-plugin-push 1.8.4 "PushPlugin"

@ethanneff
Copy link
Contributor

Hello again,

Are you getting errors whenever you run Branch methods? For example, are you able to successfully generate a Branch deep link within your app? (https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking#create-deep-link)

I ask because it seems like the Branch SDK is successfully loaded into your app:

Your logs: (0.038981ms)

017-08-16 21:18:55.440528+0200 Zently[3076:1044851] CDVPlugin class BranchSDK (pluginName: branchsdk) does not exist.
2017-08-16 21:18:55.440548+0200 Zently[3076:1044851] [CDVTimer][branchsdk] 0.038981ms

My logs: (0.603974ms)

2017-08-16 13:13:46.684 Branch Testing[834:286263] Using UIWebView
2017-08-16 13:13:46.686 Branch Testing[834:286263] [CDVTimer][handleopenurl] 0.060022ms
2017-08-16 13:13:46.687 Branch Testing[834:286263] [CDVTimer][intentandnavigationfilter] 1.362979ms
2017-08-16 13:13:46.687 Branch Testing[834:286263] [CDVTimer][gesturehandler] 0.048995ms
2017-08-16 13:13:46.688 Branch Testing[834:286263] [CDVTimer][branchsdk] 0.603974ms
2017-08-16 13:13:46.688 Branch Testing[834:286263] [CDVTimer][TotalPluginStartup] 2.442002ms

I have a feeling the first error you are getting is a race condition, but the Branch SDK is eventually being loaded into your app.

ethanneff added a commit that referenced this issue Aug 16, 2017
@amovsesy
Copy link
Author

@ethanneff I tried with the latest code and am still seeing the issue. I am getting the error multiple time so I don't think the branch SDK is ever loading. The first time I see that error does seem like a race condition where it doesn't load, but then on ready i run Branch.init and it still says the plugin is not found.

@amovsesy
Copy link
Author

Anyone with insights on the issue, I have not been able to get this to work and the current version of the branch plugin I am using is crashing on the devices of some of our users so I'd like to figure out a path forward for us.

@ethanneff
Copy link
Contributor

Hello again,

I am still unable to reproduce this on my end. However, I was able to look around the internet and found some possible solutions:

  1. Don't put a space in your application name within config.xml (link)

    • <name>My Cordova Test</name>
    • <name>MyCordovaTest</name>
  2. Your platform may be corrupted. Rebuild it (link)

    • cordova platform remove ios
    • cordova platform add ios
  3. Upgrade your outdated PhoneGab build (link)

    • npm update -g cordova
  4. Rebuild the Branch SDK. There is a chance the .h and .m files were not installed the first time /plugin/branch-crodova-sdk/src/ios (link)

Thanks,

@jans-y
Copy link

jans-y commented Aug 31, 2017

Hello, I am having the same issue.

I do not understand update guide -> https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking#compiling-updating-the-branch-sdk , you posted earlier in this thread.

Shoudln't I run "ionic cordova plugin add branch-cordova-sdk" ?

If not, how should I install the plugin?

Thank you.

@ethanneff
Copy link
Contributor

The Branch SDK is installed from <plugin name="branch-cordova-sdk" spec="^2.6.0" /> in your config.xml whenever you do a cordova build ios or cordova build android.

You should not have to install the Branch SDK from ionic cordova plugin add branch-cordova-sdk.

Thanks,

@HardikDG
Copy link

@ethanneff Can you provide exact steps for the installation of Branch SDK for an Ionic project?

As per your previous comment, we should not run the command ionic cordova plugin add branch-cordova-sdk. We should have installed automatically with the ionic build command with the other parameters specified in the .

But In the another post Adding plugin issue in the same week, you have written steps like

cordova platform rm ios
cordova plugin rm phonegap-plugin-push
cordova plugin rm branch-cordova-sdk
cordova plugin add branch-cordova-sdk   \\ <--- Add a plugin via cordova plugin add
cordova plugin add phonegap-plugin-push
cordova platform add ios
cordova build ios
cordova run ios --device

So I am confused with what is the correct and better flow installation of the Branch SDK integration in the Ionic project. If you can provide some more details on installation it will be great.

@ethanneff
Copy link
Contributor

ethanneff commented Sep 29, 2017

Hello @HardikDG,

Yes, there are two ways to install Branch:

  • add <plugin name="branch-cordova-sdk" spec="^2.6.0" /> to your config.xml and then run cordova build ios or cordova build android
  • [or] run cordova plugin add branch-cordova-sdk which injects <plugin name="branch-cordova-sdk" spec="^2.6.0" /> into your config.xml and then installs Branch

Both options will work, but I don't recommend the 2nd option because Branch used to be installed via cordova plugin add branch-cordova-sdk --variable BRANCH_KEY=xxxx --variable URI_SCHEME=xxxx; which no longer works. To prevent confusion, I try not to publicize the 2nd option anywhere.

For Ionic projects, generally the best way to integrate Branch is from the Getting Started Guide on the Readme.

Thanks,

@HardikDG
Copy link

HardikDG commented Sep 30, 2017

Okay, Thanks for the quick reply. I have tried with the first option and it is working properly as expected.

For the knowledge, If I use the second method Branch will take the 'BRANCH_KEY' and 'URI_SCHEME' from <branch-config> in config.xml right? As variable installation method is not working now.

@ethanneff
Copy link
Contributor

Glad you got it working! You are correct, everything is pulled from the config.xml now.

@eternitybro
Copy link

I'm using ionic v4 I'm also receiving a runtime error from XCode:

CDVPlugin class BranchSDK (pluginName: branchsdk) does not exist.

Everything compiles fine but none of the branch functions work.

I've tried adding the plugin only in config.xml (as specified in the docs).

I've also tried using

ionic cordova plugin add branch-cordova-sdk
npm install @ionic-native/branch-io@4

as specified in the Ionic docs
and
npm install @ionic-native/branch-io@latest
and
npm install @ionic-native/branch-io

Everytime I've removed and added the ios platform.

ionic cordova platform remove ios
ionic cordova platform add ios
ionic cordova platform prepare ios

I still get this runtime error.

I've tried using:
import { BranchIo } from '@ionic-native/branch-io/ngx'
with

public branch: BranchIo;
...
this.branch.initSession().then(data => {

vs

declare var Branch
...
Branch =  Branch || (<any>window).Branch;
Branch.initSession().then(data => {

I'm worried about manually copying files over to XCode because if I add/remove the platform in the future I'll have to keep copying over a hack.

Here's my config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.keepmakingscents" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Making Scents</name>
    <description>Create, experience, share.</description>
    <author email="rob@robgungor.com" href="https://robgungor.com/">Rob Gungor</author>
    <content src="index.html" />
    <access origin="*" />
    <access origin="*facebook.com*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="19" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="AutohideSplashScreen" value="false" />
    <preference name="SplashScreenDelay" value="30000" />
    <preference name="KeyboardResize" value="true" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-facebook4" spec="4.1.0">
        <variable name="APP_ID" value="XXX" />
        <variable name="APP_NAME" value="makingScents" />
    </plugin>
    <branch-config>
        <branch-key value="key_live_XXX" />
        <uri-scheme value="makingscents" />
        <link-domain value="makingscents.app.link" />
        <ios-team-release value="XXX" />
    </branch-config>
    <plugin name="cordova-plugin-ionic-webview" spec="^2.3.2" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-taptic-engine" spec="2.1.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="2.1.3" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <preference name="SplashScreen" value="screen" />
    <plugin name="branch-cordova-sdk" spec="3.1.5" />
    <engine name="ios" spec="4.5.5" />
</widget>

Hellllllp!

@kleeb
Copy link

kleeb commented Mar 17, 2020

Sounds similar for me. The latest cordova, cordova-ios, completely fresh new project craeted from Bitrise pipeline

In file included from /Users/vagrant/git/platforms/ios/app/Plugins/branch-cordova-sdk/BranchSDK.m:1:
/Users/vagrant/git/platforms/ios/app/Plugins/branch-cordova-sdk/BranchSDK.h:4:9: fatal error: 'Branch.h' file not found
#import "Branch.h"
        ^~~~~~~~~~
1 error generated.

@echo-branch
Copy link
Contributor

@kleeb Please open a new ticket for your issue. It's likely different from the old closed issue.

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

7 participants