Manually
A guide to add Shake to your app without a dependency manager or a build automation tool.
By not using a dependency manager like CocoaPods, you won't be able to use the simple pod update Shake
command to
always pull the latest version of Shake into your app. Instead, you will have to repeat the the first step described below.
Create a new app on Dashboard
Visit your Shake Dashboard and add a new Native iOS app by clicking the Add new app button located in the bottom right corner.
Once you're done, you're ready to proceed with the steps below.
Download Shake from GitHub
Visit Shake iOS SDK GitHub repo → Download ZIP → copy Shake.framework folder into your Xcode project → drag the copied Shake.xcframework into Frameworks, Libraries, and Embedded content section of your project Target general settings.
Make sure that Embed&Sign option is selected for the Shake.xcframework.
Initialize Shake
Initialize Shake in the didFinishLaunchingWithOptions
callback of your AppDelegate.
Replace app-api-key
with the actual value you have in your app settings:
- Objective-C
- Swift
#import "AppDelegate.h"@import Shake;@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[SHKShake startWithApiKey:@"app-api-key"];return YES;}@end
import UIKitimport Shake@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {Shake.start(apiKey: "app-api-key")return true}}
Some of the Shake features use swizzling.
To avoid swizzling conflicts, call Shake.start()
before initializing other frameworks.
Build and run your project by selecting Run → Run in the menu bar.
Conditional initialization
We recommend initializing Shake in the entry point of your app. However, depending on your app, you'll want to initialize Shake just in a specific conditions, depending on your app data. You can do it as shown in the example below when your app data is available:
- Objective-C
- Swift
#import "Main.h"@import Shake;@implementation MainVC- (void)viewDidLoad {[super viewDidLoad];if ([User isTester]) {[SHKShake startWithApiKey:@"app-api-key"];}}
import UIKitimport Shakeclass MainVC: UIViewController {override func viewDidLoad() {super.viewDidLoad()title = "Main"if User.isTester() {Shake.start(apiKey: "app-api-key")}}}
Visit your Shake dashboard
Follow the instructions there to send your first feedback with Shake and you're all set.
SDK customizations
Now that Shake SDK is in your app and you have sent the first feedback for fun, everything else is optional. As the next step, try the three most popular SDK customizations: