Skip to content

Commit

Permalink
releasing 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bitlymobile committed Oct 11, 2016
1 parent 90f2b8d commit 59d1164
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 11 deletions.
Binary file modified BitlySDK.framework.zip
Binary file not shown.
72 changes: 61 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bitly iOS SDK

![Supported Platforms](https://img.shields.io/cocoapods/p/BitlySDK.svg) ![Releases](https://img.shields.io/github/release/bitly/bitly_ios_sdk_release.svg) [![Latest pod release](https://img.shields.io/cocoapods/v/BitlySDK.svg)](http://cocoapods.org/pods/BitlySDK) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.com/bitly/bitly_ios_sdk.svg?token=GQk2M5gzMUKUJCESKF18&branch=master)](https://travis-ci.com/bitly/bitly_ios_sdk)
![Supported Platforms](https://img.shields.io/cocoapods/p/BitlySDK.svg) ![Releases](https://img.shields.io/github/release/bitly/bitly_ios_sdk_release.svg) [![Latest pod release](https://img.shields.io/cocoapods/v/BitlySDK.svg)](http://cocoapods.org/pods/BitlySDK) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.com/bitly/bitly_ios_sdk.svg?token=GQk2M5gzMUKUJCESKF18&branch=master)](https://travis-ci.com/bitly/bitly_ios_sdk) [![Coverage Status](https://coveralls.io/repos/github/bitly/bitly_ios_sdk/badge.svg?t=xurvl2)](https://coveralls.io/github/bitly/bitly_ios_sdk)

## Getting Started
If you do not have any mobile apps setup in your Bitly account you will need to refer to the user guide for setting up deep links in your account.
Expand Down Expand Up @@ -41,14 +41,14 @@ The Apple app ID is your team ID and bundle ID joined with a period. In the App
```
3. Drag the built `BitlySDK.framework` into your Xcode project

## Configure the Universal links
## Configure the Universal Links
1. In Xcode open your project file
2. Go to the Capabilities tab
3. Ensure that Associated Domains is enabled and expand it
4. Click on the + button and add your domain as `applinks:yourdomain.com`
5. Ensure that the yourprojectname.entitlements file is added to the appropriate build target

## Configure the SDK
## Configure the SDK for Universal Links
1. Import the SDK in your AppDelegate

**Swift**
Expand Down Expand Up @@ -89,6 +89,7 @@ The Apple app ID is your team ID and bundle ID joined with a period. In the App
```

> By default the Bitly SDK utilizes the IDFV to identify the user. If you which to use the IDFA to track the user simply call the `initializeWithDeviceId` method when initializing the SDK.
> You can also provide the access token for shortening with the `initializeWithShortening` and `initializeWithDeviceIdAndShortening` methods.

3. Handle incoming links

Expand All @@ -101,10 +102,6 @@ The Apple app ID is your team ID and bundle ID joined with a period. In the App
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return Bitly.handleOpenUrl(url);
}

func applicationDidBecomeActive(application: UIApplication) {
Bitly.handleApplicationDidBecomeActive()
}
```

**Objective-C**
Expand All @@ -116,10 +113,6 @@ The Apple app ID is your team ID and bundle ID joined with a period. In the App
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [Bitly handleOpenUrl:url];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
[Bitly handleApplicationDidBecomeActive];
}
```

4. Retry on error
Expand All @@ -135,3 +128,60 @@ The Apple app ID is your team ID and bundle ID joined with a period. In the App
```

>If there are any issues in handling a Universal Link the operation can be retried using the following line of code in your response handler from step 2

## Configure the SDK for Shortening

1. Configure an OAUTH token for your app http://bitly.com/a/oauth_apps
2. Import the SDK in your AppDelegate

**Swift**
```swift
import BitlySDK
```

**Objective-C**
```objective-c
#import <BitlySDK/BitlySDK-Swift.h>
```

3. Initialize the SDK on application initialization

**Swift**
```swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Bitly.initializeShortening("YOUR_APP_ACCESS_TOKEN")
return true
}
```

**Objective-C**
```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Bitly initializeShortening:@"YOUR_APP_ACCESS_TOKEN"];
return YES;
}
```

> You can combine this initialization with the App Link initialization

5. You can shorten from anywhere in your application

**Swift**
```swift
Bitly.shorten("http://theurlyouwishtoshorten.com") { response, error in
// response provides a BitlyResponse object which contains the shortened Bitlink
// response includes a status code
// error provides any errors in retrieving information about the URL
// Your custom logic goes here...
}
```

**Objective-C**
```objective-c
[Bitly shorten:@"http://theurlyouwishtoshorten.com" handler:^(BitlyResponse * response, NSString * error) {
// response provides a BitlyResponse object which contains the shortened Bitlink
// response includes a status code
// error provides any errors in retrieving information about the URL
// Your custom logic goes here...
}];
```

0 comments on commit 59d1164

Please sign in to comment.