# Integrating Updraft iOS SDK

## Github

{% embed url="<https://github.com/appswithlove/updraft-sdk-ios/>" %}
Updraft iOS SDK Github
{% endembed %}

## Requirements

* iOS 10.0+
* Xcode 9.0+
* Swift 4.0+

## Installation

#### CocoaPods

Get [CocoaPods](http://cocoapods.org/) and specify UpdraftSDK in your Podfile:

```
pod 'UpdraftSDK'
```

Then, run:

```
pod install
```

#### Carthage

Get [Carthage](https://github.com/Carthage/Carthage) and specify Updraft in your Cartfile:

```
github 'appswithlove/updraft-sdk-ios'
```

Then, run:

```
carthage update
```

In your application targets “General” tab under the “Linked Frameworks and Libraries” section, drag and drop Updraft.framework from the Carthage/Build/iOS directory that carthage update produced.

## Setup

#### Swift

1. Import Updraft module in AppDelegate:

   ```
   import Updraft
   ```
2. Start the SDK with your "SDK Key" and "App Key":

   ```
   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
   	
   	Updraft.shared.start(sdkKey: "YOUR_SDK_KEY", appKey: "YOUR_APP_KEY")
   		
   	return true
   }
   ```

#### Objective-C

1. Import Updraft module in AppDelegate

   ```
   @import Updraft;
   ```
2. Start the SDK with your "SDK Key" and "App Key":

   ```
   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

   		[[Updraft shared] startWithSdkKey:@"YOUR_SDK_KEY" appKey:@"YOUR_APP_KEY" isAppStoreRelease: false];

   		return YES;
   	}
   ```

**Parameters**

* **sdkKey**: Your sdk key obtained on [Updraft](https://getupdraft.com/)
* **appKey**: You app key obtained on [Updraft](https://getupdraft.com/)

## Auto Update

Auto Update functionality can be enabled/disabled on [getupdraft.com](https://getupdraft.com/) in your app edit menu.

AutoUpdate work by comparing the build number of the app installed on the user's device and the app uploaded on GetUpdraft.

A prompt is displayed to the user if his installed version is lower than the version on Updraft. Thus, the build number must be incremented for each new build release to trigger the auto-update process.

Micro version comparison is supported, for example version 1.2.3.2018080**4** is greater than version 1.2.3.2018080**3**

## Feedback & Bug Reporting

Feedback functionality can be enabled/disabled on [getupdraft.com](https://getupdraft.com/) in your app edit menu.

A prompt is shown to the user to inform him of the change of state of the feedback functionality.

If enabled, the user is explained how he can give feedback. User can take a screenshot to give a feedback.

## Advanced setup

#### Logging

To check if data is send properly to Updraft and also see some additional SDK log data in the console, you can set different log levels.

To change the log level, add the following line before starting the SDK:

**Swift**

```
Updraft.shared.logLevel = .info
```

**Objective-C**

```
[Updraft shared].logLevel = LogLevelInfo;
```

Default level: **warning** => Only warnings and errors will be printed.

## Base URL

If you have your own instance of Updraft, set this property to the base URL of your instance, before starting the SDK.

**Swift**

```
Updraft.shared.baseUrl = "https://your_base_url/"
```

**Objective-C**

```
[Updraft shared].baseUrl = @"https://your_base_url/";
```

Default [**https://getupdraft.com/**](https://getupdraft.com/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getupdraft.com/~/changes/hCUa1az9yKp7rsxQS8yk/updraft-sdk/ios-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
