Skip to content

Commit 5f86bef

Browse files
fix merge conflict
2 parents 4aabbc4 + 13db161 commit 5f86bef

File tree

9 files changed

+84
-146
lines changed

9 files changed

+84
-146
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ _Questions? [Contact us](https://support.branch.io/support/tickets/new)_
5555
* [Compiling: Updating the Branch SDK](#compiling-updating-the-branch-sdk)
5656
* [Compiling: Incompatible Plugins](#compiling-incompatible-plugins)
5757
* [Compiling: Errors](#compiling-errors)
58+
* [Compiling: Capacitor](#compiling-capacitor)
59+
* [AppStore: iOS](#appstore-ios)
5860

5961
## Getting Started
6062

@@ -727,7 +729,6 @@ _Questions? [Contact us](https://support.branch.io/support/tickets/new)_
727729
<link-domain value="bnc.lt" /> <!-- optional previous link domain -->
728730
<ios-team-release value="PW4Q8885U7" /> <!-- required if iOS app -->
729731
<ios-team-debug value="FG35JLLMXX" /> <!-- optional -->
730-
<android-prefix value="/WSuf" /> <!-- optional (for bnc.lt link domains) -->
731732
<android-testmode value="true" /> <!-- optional (simulate installs) -->
732733
</branch-config>
733734
```
@@ -1348,3 +1349,61 @@ _Questions? [Contact us](https://support.branch.io/support/tickets/new)_
13481349
```
13491350
13501351
* Add `<preference name="android-minSdkVersion" value="16" />` to your `config.xml`
1352+
1353+
* error
1354+
1355+
```sh
1356+
Branch.h not found
1357+
```
1358+
If that is the ONLY error you see, this can be fixed by upgrading dependencies.
1359+
Ensure you are using version 4.0.1 of this plugin or higher and have updated your Xcode, Cordova, and other dependencies (listed below) to the latest versions. This error arose due to an inability in CocoaPods and cordova-ios to resolve dependencies that was later fixed.
1360+
1361+
Sometimes this error occurs when a build error occurs in the Pod project; since Branch is usually the first pod alphabetically, it'll show up as the error when attempting to build the main project (since the Pod didn't get built), even though the real error is elsewhere. Make sure to read your build log to find the original error that prevented building the Pod project.
1362+
1363+
* error: ios build fails with Pods and CONFIGURATION_BUILD_DIR configured
1364+
1365+
Command-line builds result in the above error. Please see the section below [Compiling: Capacitor](#compiling-capacitor) for the full list of up-to-date dependencies needed for CLI builds to work.
1366+
1367+
* #### Compiling: Capacitor
1368+
1369+
* ##### Version 4.0.1 of this plugin works with Ionic 4 + Cordova and Ionic 4 + Capacitor, with the following caveats:
1370+
1371+
* We strongly recommend Node >= 10.15. Node 8 might work, but it is not tested.
1372+
* For BOTH Cordova and Capacitor, you must use Xcode >= 11.1, CocoaPods >= 1.8.4, Cordova >= 9.0.0, Ionic-CLI >= 5.1, cordova-ios >= 5.1.0
1373+
* Every single one of these dependencies has fixes that allow the command line build, and the pod dependency resolution to work correctly
1374+
* You MUST use @capacitor/ios >= 1.4.0. Versions prior to that version did not federate the OpenURL notifications to other plugins, including Branch.
1375+
* `use_frameworks` has been removed from this plugin and will now be statically built. If the other podfile uses `use_frameworks` that is fine but this plugin no longer flags itself as dynamic.
1376+
* When using Capacitor, you must add the following entries yourself to `ios/App/App/Info.plist`:
1377+
```sh
1378+
<key>CFBundleURLTypes</key>
1379+
<array>
1380+
<dict>
1381+
<key>CFBundleURLName</key>
1382+
<string>com.getcapacitor.capacitor</string>
1383+
<key>CFBundleURLSchemes</key>
1384+
<array>
1385+
<string>capacitor</string>
1386+
</array>
1387+
</dict>
1388+
<dict>
1389+
<key>CFBundleURLName</key>
1390+
<string>branch-cordova-sdk</string>
1391+
<key>CFBundleURLSchemes</key>
1392+
<array>
1393+
<string>[YOUR URL SCHEME HERE]</string>
1394+
</array>
1395+
</dict>
1396+
</array>
1397+
<key>branch_key</key>
1398+
<string>[YOUR BRANCH LIVE KEY]</string>
1399+
<key>branch_app_domain</key>
1400+
<string>[YOUR DOMAIN].app.link</string>
1401+
```
1402+
* When using Capacitor, you must add your Associated Domains entitlements via the Xcode entitlement editor yourself
1403+
* This MUST be done using Xcode - this is part of Capacitor's philosophy whereby you are in control of every config file change
1404+
* Open the "Signing & Entitlements" tab in Xcode, add the Associated Domains entitlement, and add the urls found on your Branch dashboard.
1405+
1406+
* #### AppStore: iOS
1407+
1408+
* #### App rejected because it uses push notification features but does not declare the aps-environment key
1409+
When branch-cordova-sdk moved to use CocoaPods, a change was introduced in Cordova 9 where the separate entitlement files were no longer flattened together. This issue has been fixed in version 4.0.1 of this plugin.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "branch-cordova-sdk",
33
"description": "Branch Metrics Cordova SDK",
44
"main": "src/index.js",
5-
"version": "4.0.0",
5+
"version": "4.0.1",
66
"homepage": "https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking",
77
"repository": {
88
"type": "git",
@@ -17,7 +17,7 @@
1717
],
1818
"license": "MIT",
1919
"engines": [
20-
{
20+
{
2121
"name": "cordova",
2222
"version": ">=9.0.0"
2323
}

plugin.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SOFTWARE.
2424
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
2525
xmlns:android="http://schemas.android.com/apk/res/android"
2626
id="branch-cordova-sdk"
27-
version="4.0.0">
27+
version="4.0.1">
2828

2929
<!-- Description -->
3030
<name>branch-cordova-sdk</name>
@@ -36,7 +36,7 @@ SOFTWARE.
3636

3737
<!-- Dependencies -->
3838
<engines>
39-
<engine name="cordova" version=">=3.5.0" />
39+
<engine name="cordova" version=">=9.0.0" />
4040
</engines>
4141

4242
<!-- Hooks -->
@@ -85,8 +85,8 @@ SOFTWARE.
8585
<config>
8686
<source url="https://github.com/CocoaPods/Specs.git"/>
8787
</config>
88-
<pods use-frameworks="true">
89-
<pod name="Branch" spec="~> 0.29.0" />
88+
<pods>
89+
<pod name="Branch" spec="~> 0.31.3" />
9090
</pods>
9191
</podspec>
9292
</platform>

src/android/io/branch/BranchSDK.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,15 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
264264
}
265265

266266
public void crossPlatformIds(CallbackContext callbackContext) {
267-
this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext));
267+
// stub call from known issue with caching
268+
// this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext));
269+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, false));
268270
}
269271

270272
public void lastAttributedTouchData(CallbackContext callbackContext) {
271-
this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30);
273+
// stub call from known issue with caching
274+
// this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30);
275+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, false));
272276
}
273277

274278
//////////////////////////////////////////////////

src/ios/AppDelegate+BranchSdk.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#import <Branch/Branch.h>
99
#endif
1010

11+
// Provides Ionic Capacitor compatibility
12+
#import <Cordova/CDVPlugin.h>
13+
1114
@interface AppDelegate (BranchSDK)
1215

1316
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler;

src/ios/BranchSDK.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ - (void)listOnSpotlight:(CDVInvokedUrlCommand*)command {
746746

747747
- (void)crossPlatformIds:(CDVInvokedUrlCommand *)command {
748748
NSMutableDictionary *json = [NSMutableDictionary new];
749-
749+
750750
Branch *branch = [self getInstance];
751751
[branch crossPlatformIdDataWithCompletion:^(BranchCrossPlatformID *cpid) {
752752
CDVPluginResult* pluginResult = nil;
@@ -760,9 +760,9 @@ - (void)crossPlatformIds:(CDVInvokedUrlCommand *)command {
760760
for (BranchProbabilisticCrossPlatformID *tmp in cpid.probabiliticCrossPlatformIDs) {
761761
if (tmp.crossPlatformID && tmp.score) {
762762
NSMutableDictionary *pair = [NSMutableDictionary new];
763-
[pair setObject:tmp.crossPlatformID forKey:@"id"];
763+
[pair setObject:tmp.crossPlatformID forKey:@"id"];
764764
[pair setObject:tmp.score forKey:@"probability"];
765-
[probCPIDs addObject:pair];
765+
[probCPIDs addObject:pair];
766766
}
767767
}
768768
[json setObject:probCPIDs forKey:@"prob_cross_platform_ids"];
@@ -777,9 +777,9 @@ - (void)crossPlatformIds:(CDVInvokedUrlCommand *)command {
777777

778778
- (void)lastAttributedTouchData:(CDVInvokedUrlCommand *)command {
779779
NSMutableDictionary *json = [NSMutableDictionary new];
780-
780+
781781
Branch *branch = [self getInstance];
782-
[branch lastTouchAttributedDataWithCompletion:^(BranchLastAttributedTouchData * _Nullable latd) {
782+
[branch lastAttributedTouchDataWithAttributionWindow:30 completion:^(BranchLastAttributedTouchData * _Nullable latd) {
783783
CDVPluginResult* pluginResult = nil;
784784
if (latd) {
785785
[json setObject:latd.attributionWindow forKey:@"attribution_window"];

src/scripts/hooks/beforePrepare.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
(function() {
1+
(function () {
22
// properties
33

44
const configPreferences = require("../npm/processConfigXml.js");
55
const iosPlist = require("../ios/updatePlist.js");
6-
const iosCapabilities = require("../ios/enableEntitlements.js");
76
const iosAssociatedDomains = require("../ios/updateAssociatedDomains.js");
87
const IOS = "ios";
98

@@ -18,7 +17,6 @@
1817
platforms.forEach(platform => {
1918
if (platform === IOS) {
2019
iosPlist.addBranchSettings(preferences);
21-
iosCapabilities.enableAssociatedDomains(preferences);
2220
iosAssociatedDomains.addAssociatedDomains(preferences);
2321
}
2422
});

src/scripts/ios/enableEntitlements.js

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/scripts/ios/updateAssociatedDomains.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
(function() {
1+
(function () {
22
// properties
33

44
const path = require("path");
55
const fs = require("fs");
66
const plist = require("plist");
77
const mkpath = require("mkpath");
8+
// TODO [codinronan 15.01.2020]: Read these from {preferences.projectName}.plist --
9+
// most people don't change them, but some do, and more importantly, some people add new ones!
810
const BUILD_TYPES = ["Debug", "Release"];
911
const ASSOCIATED_DOMAINS = "com.apple.developer.associated-domains";
1012

@@ -29,24 +31,6 @@
2931
// get the xcode .entitlements and provisioning profile .plist
3032
function getEntitlementFiles(preferences) {
3133
const files = [];
32-
const entitlements = path.join(
33-
preferences.projectRoot,
34-
"platforms",
35-
"ios",
36-
preferences.projectName,
37-
"Resources",
38-
`${preferences.projectName}.entitlements`
39-
);
40-
files.push(
41-
path.join(
42-
preferences.projectRoot,
43-
"platforms",
44-
"ios",
45-
preferences.projectName,
46-
`${preferences.projectName}.entitlements`
47-
)
48-
);
49-
files.push(entitlements);
5034

5135
for (let i = 0; i < BUILD_TYPES.length; i++) {
5236
const buildType = BUILD_TYPES[i];

0 commit comments

Comments
 (0)