Installation and Setup

Installation

Download the latest version

Dynamic Framework Installation

  1. Drag the Mobile Buy SDK.xcodeproj into your existing project.
  2. Add the Buy target as a Target Dependancy in the Build Phases of your project's target.
  3. Add the Buy (second target on the list is the Dynamic framework) target in the Embedded Binaries section in Build Phases.

See the Sample Apps for an example of Dynamic Framework usage.

Static Framework Installation

If you would like to not include the iOS Buy SDK Project within your existing project, you can link directly to the Buy.framework.

  1. Open the Mobile Buy SDK.xcodeproj and build the Static Universal Framework scheme.
  2. Drag the Buy.framework that was just created from Mobile Buy SDK Sample Apps into the Linked Frameworks and Libraries section for the target you want to add the framework to. Check Copy items, if needed, so the framework is copied to your project.
  3. In the Build Settings tab, add -all_load to Other Linker Flags.

CocoaPods

Add the following line to your podfile:

pod "Mobile-Buy-SDK"

Then run pod install.

#import "Buy.h"

Carthage

Add the following line to your Cartfile:

github "Shopify/mobile-buy-sdk-ios"

Then run carthage update

Initializing the framework

Tip

See for help creating credentials for your shop.

Import the Buy header (Dynamic Framework example):

@import Buy;

Initialize the client:

NSString * const SHOP_DOMAIN = @"my_shop.myshopify.com";
NSString * const API_KEY = @"abcd1345efgh6789";
NSString * const APP_ID = @"8";

BUYClient *client = [[BUYClient alloc] initWithShopDomain:SHOP_DOMAIN
                                                   apiKey:API_KEY
                                                   applId:APP_ID];