Skip to content

Commit 9665c96

Browse files
committed
Merge branch 'master' of ssh://github.com/BranchMetrics/ios-branch-deep-linking into staging
2 parents 8db448b + 4298493 commit 9665c96

File tree

3 files changed

+73
-29
lines changed

3 files changed

+73
-29
lines changed

Branch-TestBed/Branch-TestBed/Branch-TestBed-Info.plist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@
5555
<string>UIInterfaceOrientationPortrait</string>
5656
</array>
5757
<key>BranchLogLevel</key>
58-
<string>BNCLogLevelDebugSDK</string>
58+
<string>BNCLogLevelAll</string>
59+
<key>branch_universal_link_domains</key>
60+
<string>bnctestbed.app.link</string>
5961
<key>branch_key</key>
6062
<dict>
6163
<key>live</key>
6264
<string>key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv</string>
6365
<key>test</key>
6466
<string>key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc</string>
6567
</dict>
66-
<key>BranchLogLevel</key>
67-
<string>BNCLogLevelAll</string>
6868
</dict>
6969
</plist>

README.md

Lines changed: 70 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ There's a full demo app embedded in this repository, but you can also check out
6363

6464
## Installation
6565

66-
_The iOS SDK footprint is 220kb by itself_
66+
_The iOS SDK footprint is 220kb by itself._
6767

6868
### Available in CocoaPods
6969

@@ -173,7 +173,7 @@ Alternatively, you can add the URI scheme in your project's Info page.
173173

174174
![URL Scheme Demo](https://s3-us-west-1.amazonaws.com/branchhost/urlType.png)
175175

176-
### Support Universal Linking (iOS 9)
176+
### Support Universal Linking (iOS 9 and Above)
177177

178178
With iOS 9, Apple has added the ability to allow http links to directly open your app, rather than using the URI Schemes. This can be a pain to set up, as it involves a complicated process on your server. The good news is that Branch does this work for you with just two steps!
179179

@@ -193,11 +193,19 @@ With iOS 9, Apple has added the ability to allow http links to directly open you
193193

194194
![Dashboard Enable UL](docs/images/dashboard-ul-enable.png)
195195

196+
#### Custom Domain Name Configuration (Required if you don't use the Branch provided xxxx.app.link domain)
197+
198+
Branch provides a xxxx.app.link domain for your app, but you can use your own custom domain for app links instead. If you _do_ use your own custom domain for your universal app links, you need to add it to your Info.plist.
199+
200+
Add the `branch_universal_link_domains` key with your custom domain as a string value:
201+
202+
![Custom Domain Info.plist](docs/images/custom-domain.png)
203+
196204
#### URI Scheme Considerations
197205

198206
The Branch SDK will pull the first URI Scheme from your list that is not one of `fb`, `db`, or `pin`. This value will be used one time to set the iOS URI Scheme under your Link Settings in the Branch Dashboard.
199207

200-
For additional help configuring the SDK, including step-by-step instructions, please see the [iOS Quickstart Guide](https://github.com/BranchMetrics/Branch-Integration-Guides/blob/master/ios-quickstart.md).
208+
For additional help configuring the SDK, including step-by-step instructions, please see the [iOS Quickstart Guide](https://docs.branch.io/pages/apps/ios/).
201209

202210
### Get a Singleton Branch Instance
203211

@@ -405,6 +413,8 @@ Nothing
405413

406414
**BOOL** continueUserActivity will return a boolean indicating whether Branch has handled the Universal Link. If Universal Link is powered by Branch, then continueUserActivity will return YES because the Branch click object is present.
407415

416+
If you use your own custom universal link domain, make sure you add it your Info.plist under the `branch_universal_link_domains` key as described [here](#custom-domain-name-configuration) or this method may erroneously return `NO` when in fact the universal link will be opened.
417+
408418
### Register a Deep Link Controller
409419

410420
Register a controller for Branch to show when specific keys are present in the Branch open / install dictionary. This is the mechanism to handle auto deep linking and should be called before `initSession`.
@@ -760,14 +770,14 @@ Here are a set of best practices to ensure that your analytics are correct, and
760770
Note: Content indexed using `CSSearchableItem` could be removed from Spotlight but cannot be removed if indexed using `NSUserActivity`.
761771

762772
Practices to _avoid_:
763-
1. Don't set the same `title`, `contentDescription` and `imageUrl` across all objects
764-
2. Don't wait to initialize the object and register views until the user goes to share
765-
3. Don't wait to initialize the object until you conveniently need a link
773+
1. Don't set the same `title`, `contentDescription` and `imageUrl` across all objects.
774+
2. Don't wait to initialize the object and register views until the user goes to share.
775+
3. Don't wait to initialize the object until you conveniently need a link.
766776
4. Don't create many objects at once and register views in a `for` loop.
767777

768778
### Branch Universal Object
769779

770-
#### Methods
780+
#### Methods and Properties
771781

772782
###### Objective-C
773783

@@ -780,8 +790,9 @@ BranchUniversalObject *branchUniversalObject = [[BranchUniversalObject alloc] in
780790
branchUniversalObject.title = @"My Content Title";
781791
branchUniversalObject.contentDescription = @"My Content Description";
782792
branchUniversalObject.imageUrl = @"https://example.com/mycontent-12345.png";
783-
[branchUniversalObject addMetadataKey:@"property1" value:@"blue"];
784-
[branchUniversalObject addMetadataKey:@"property2" value:@"red"];
793+
branchUniversalObject.contentMetadata.contentSchema = BranchContentSchemaCommerceProduct;
794+
branchUniversalObject.contentMetadata.customMetadata[@"property1"] = @"blue";
795+
branchUniversalObject.contentMetadata.customMetadata[@"property2"] = @"red";
785796
```
786797
787798
###### Swift
@@ -791,33 +802,66 @@ let branchUniversalObject: BranchUniversalObject = BranchUniversalObject(canonic
791802
branchUniversalObject.title = "My Content Title"
792803
branchUniversalObject.contentDescription = "My Content Description"
793804
branchUniversalObject.imageUrl = "https://example.com/mycontent-12345.png"
794-
branchUniversalObject.addMetadataKey("property1", value: "blue")
795-
branchUniversalObject.addMetadataKey("property2", value: "red")
805+
branchUniversalObject.contentMetadata.contentSchema = .product;
806+
branchUniversalObject.contentMetadata.customMetadata["property1"] = "blue"
807+
branchUniversalObject.contentMetadata.customMetadata["property2"] = "red"
796808
```
797809

798-
#### Parameters
810+
#### Properties
799811

800812
**canonicalIdentifier**: This is the unique identifier for content that will help Branch de-dupe across many instances of the same thing. If you have a website with pathing, feel free to use that. Or if you have database identifiers for entities, use those.
801813

802-
**title**: This is the name for the content and will automatically be used for the OG tags. It will insert $og_title into the data dictionary of any link created.
814+
**title**: This is the name for the content and will automatically be used for the OG tags. It will insert `$og_title` into the data dictionary of any link created.
803815

804-
**contentDescription**: This is the description for the content and will automatically be used for the OG tags. It will insert $og_description into the data dictionary of any link created.
816+
**contentDescription**: This is the description for the content and will automatically be used for the OG tags. It will insert `$og_description` into the data dictionary of any link created.
805817

806-
**imageUrl**: This is the image URL for the content and will automatically be used for the OG tags. It will insert $og_image_url into the data dictionary of any link created.
818+
**imageUrl**: This is the image URL for the content and will automatically be used for the OG tags. It will insert `$og_image_url` into the data dictionary of any link created.
807819

808-
**metadata**: These are any extra parameters you'd like to associate with the Branch Universal Object. These will be made available to you after the user clicks the link and opens up the app. To add more keys/values, just use the method `addMetadataKey`.
820+
**keywords**: Key words that describe the object. These are used for Spotlight search and web scraping so that users can find your content.
809821

810-
**price**: The price of the item to be used in conjunction with the commerce related events below.
822+
**locallyIndex**: If set to true, Branch will index this content on Spotlight on the user's phone.
811823

812-
**currency**: The currency representing the price in [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217). Default is USD.
813-
814-
**contentIndexMode**: Can be set to the ENUM of either `ContentIndexModePublic` or `ContentIndexModePrivate`. Public indicates that you'd like this content to be discovered by other apps. Content would be indexed using `NSUserActivity` if set to pulic, else would be indexed using `CSSearchableIndex`. Currently, this is only used for Spotlight indexing but will be used by Branch in the future.
824+
**publiclyIndex**: If set to true, Branch will index this content on Google, Branch, etc.
815825

816826
**expirationDate**: The date when the content will not longer be available or valid. Currently, this is only used for Spotlight indexing but will be used by Branch in the future.
817827

818-
#### Returns
828+
**contentMetadata**: Details that further describe your content. Set the properties of this sub-object depending on the type of content that is relevant to your content:
819829

820-
None
830+
#### BranchUniversalObject.contentMetadata
831+
832+
The `BranchUniversalObject.contentMetadata` properties further describe your content. These properties are trackable in the Branch dashboard and will be automatically exported to your connected third-party app intelligence partners like Adjust or Mixpanel.
833+
834+
Set the properties of this sub-object depending on the type of content that is relevant to your content. The `BranchUniversalObject.contentMetadata.contentSchema` property describes the type of object content. Set other properties as is relevant to the type.
835+
836+
**contentMetadata.contentSchema**: Set this property to a `BranchContentSchema` enum that best describes the content type. It accepts values like `BranchContentSchemaCommerceProduct` and `BranchContentSchemaMediaImage`.
837+
838+
**contentMetadata.customMetadata**: This dictionary contains any extra parameters you'd like to associate with the Branch Universal Object. These will be made available to you after the user clicks the link and opens up the app.
839+
840+
**contentMetadata.price**: The price of the item to be used in conjunction with the commerce related events below.
841+
842+
**contentMetadata.currency**: The currency representing the price in [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217). The default is USD.
843+
844+
**contentMetadata.quantity**: The quantity.
845+
846+
**contentMetadata.sku**: The vendor SKU.
847+
848+
**contentMetadata.productName**: Product name.
849+
850+
**contentMetadata.productBrand**: Product brand.
851+
852+
**contentMetadata.productCategory**: The `BNCProductCategory` value, such as `BNCProductCategoryAnimalSupplies` or `BNCProductCategoryFurniture`.
853+
854+
**contentMetadata.productVariant**: The product variant.
855+
856+
**contentMetadata.condition**: The `BranchCondition` value, such as `BranchConditionNew` or `BranchConditionRefurbished`.
857+
858+
**ratingAverage, ratingCount, ratingMax**: The rating for your content.
859+
860+
**addressStreet, addressCity, addressRegion, addressCountry, addressPostalCode**: The address of your content.
861+
862+
**latitude, longitude**: The longitude and latitude of your content.
863+
864+
**imageCaptions**: Image captions for the content's images.
821865

822866
### Tracking User Interactions With An Object
823867

@@ -1129,7 +1173,7 @@ If you'd like to list your Branch Universal Object with link properties in Spotl
11291173
```swift
11301174
universalObject.listOnSpotlight(with: linkProperty) { (url, error) in
11311175
if (error == nil) {
1132-
print("Successfully indexed on spotlight")
1176+
print("Successfully indexed on spotlight")
11331177
}
11341178
}
11351179
```
@@ -1144,7 +1188,7 @@ None
11441188

11451189
### List Multiple Branch Universal Objects On Spotlight using CSSearchableIndex
11461190

1147-
If you'd like to list multiple Branch Universal Object in Spotlight local index, this is the method you'll call in Branch.h.
1191+
Call this method on the Branch shared instance to list multiple Branch Universal Objects in Spotlight:
11481192

11491193
#### Methods
11501194

@@ -1163,7 +1207,7 @@ If you'd like to list multiple Branch Universal Object in Spotlight local index,
11631207
###### Swift
11641208
11651209
```swift
1166-
Branch.getInstance().indexOnSpotlight(usingSearchableItems: universalObjects,
1210+
Branch.getInstance().indexOnSpotlight(usingSearchableItems: universalObjects,
11671211
completion: { (universalObjects, error) in
11681212
if (error) {
11691213
// Successfully able to index all the BUO on spotloght
@@ -1278,7 +1322,7 @@ Branch.getInstance().removeAllPrivateContentFromSpotLight { (error) in
12781322

12791323
#### Parameters
12801324

1281-
**Callback**: Will return once all Branch Universal Object is removed from spotlight.
1325+
**Callback**: Will return once all Branch Universal Object is removed from spotlight.
12821326
Note: SpotlightIdentifer would not be nil of all the Branch Universal Object been removed from spotlight as Branch SDK doesn't cache the Branch Universal Objects.
12831327

12841328
#### Returns

docs/images/custom-domain.png

66.4 KB
Loading

0 commit comments

Comments
 (0)