createBranchUniversalObject Error (Ionic)
See original GitHub issueI have succesfully Initialized and setup deeplinking in my Ionic 3 application like so.
const branchInit = () => {
if (!platform.is('cordova')) { return }
Branch.initSession( (data) => {
console.log('Branch Initialized');
if (data.$deeplink_path) {
this.logger.logEvent('deeplink', {});
console.log('Routing Link' + JSON.stringify(data.$deeplink_path));
this.routeLink(data.$deeplink_path);
}
}).then( () => {
console.log('Branch Init');
}).catch( (err) => {
console.log('Branch Init Error: ' + JSON.stringify(err));
});
}
branchInit();
Branch.setDebug(true);
And deeplinking works fine if I generate a deeplink from the branch dashboard. But when I try and create a deeplink in app, I recieve an error when calling Branch.createBranchUniversalObject that has no information attached.
let fakeProps = {
canonicalIdentifier: "123",
canonicalUrl: "http://example.com/123",
title: "Content 123",
contentDescription: "Content 123 " + Date.now(),
contentImageUrl: "http://lorempixel.com/400/400",
price: 12.12,
currency: "GBD",
contentIndexingMode: "private",
contentMetadata: {
"custom": "data",
"testing": 123,
"this_is": true
}
};
Branch.createBranchUniversalObject(fakeProps).then(function (res) {
this.branchUniversalObj = res
// alert('Response: ' + JSON.stringify(res))
}).catch(function (err) {
console.log('Universal Error: ' + JSON.stringify(err));
alert('Universal Object Error: ' + JSON.stringify(err))
});
Always throws
"Universal E
rror: {"__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled
","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}
Which seems like a pretty non-usefull error message. Any thoughts?
Edit: If this helps, this is my system information.
Cordova CLI: 6.5.0
Ionic Framework Version: 3.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.1.0
Xcode version: Xcode 8.3.3 Build version 8E3004b
I could provide y’all with a example app, but I would need to link my branch configuration to it so I would need to send it via email.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
branch.io deeplink not working as expected in ionic 3
I have integrated branch.io deeplink in my ionic 3 application. ... createBranchUniversalObject(properties).then(function (res) ...
Read more >Cordova PhoneGap Ionic - Branch Help
Complete your Branch Dashboard Cordova and Ionic Change the following values to match your ... createBranchUniversalObject(properties).then(function (res) ...
Read more >branch-cordova-sdk - npm
This is a repository of our open source Cordova | Phonegap | Ionic SDK, ... you can easily get its success and error...
Read more >BranchIo | Ionic Documentation
BranchIo. Branch.io is an attribution service for deeplinking and invitation links. https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep- ...
Read more >Deep Linking implementation in phonegap
cordova plugin add https://github.com/BranchMetrics/cordova-ionic-phonegap- ... createBranchUniversalObject({ canonicalIdentifier : 'identifier', title ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I figured it out.
What was happening was a incorrect reference to “this.branchUniversalObj” in my code
So generally, it came down to an issue of order of operations. Because I wanted to generate the Universal object on page load, and then generate the share URL later, I needed to declare a class scoped variable.
Then I reference this and set it up. The correct implementation (and what I think you should change your docs to) is to use an arrow function here to keep the reference to “this” the same.
Thanks for the help, your code helped me find this bug.
Seeing as Ionic automatically sets up ts parsing you might as well. No harm unless you need to reference the context of the callback for some reason.