Giter Site home page Giter Site logo

alexfish / kissmetrics-ios-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kissmetrics/kissmetrics-ios-sdk

0.0 1.0 0.0 2.89 MB

iOS SDK for KISSmetrics

Home Page: http://support.kissmetrics.com/apis/ios-v2

License: Apache License 2.0

Objective-C 99.63% C 0.37%

kissmetrics-ios-sdk's Introduction

KISSmetrics-iOS-SDK

This workspace contains the source files that build the SDK as a framework (KISSmetricsSDK.framework) and the required public interface (KISSmetricsAPI.h). The source files included here are not intended to be used directly in your app.

For implementation details please see: http://support.kissmetrics.com/apis/ios-v2

Framework project setup:

Setting up a framework project requires several steps and may change from one version of Xcode to the next. Rather than listing all the steps here, please refer to this tutorial: http://blog.db-in.com/universal-framework-for-ios/

CocoaPods:

Add pod 'KISSmetrics-iOS-SDK' to your Podfile.

Inclusion:

Import the API class in your AppDelegate and in any classes where you'll be tracking from:

#import <KISSmetricsSDK/KISSmetricsAPI.h>

Initialization:

Manual: (Required if KISSmetricsAPI_options.m is not used) At the top of the application delegate's didFinishLaunchingWithOptions method, add:

[KISSmetricsAPI sharedAPIWithKey:@"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"];

Automatic: (Requires KISSmetricsAPI_options.m) The customer's settings, including their API key, will live in KISSmetricsAPI_options.m We can build this file for them based on selections made during new KM Product setup and deliver it along with KISSmetricsAPI.framework and KISSmetricsAPI.h. If this file is included, attemps to initialize with sharedAPIWithKey will be ignored. Even if the provided key is different than the key set in KISSmetricsAPI_options.m.

Tests:

The SDK will support both ARC/non-ARC and 32bit/64bit projects. One test project is included in this workspace for running application integration tests against the build files directly.

File organization:

All API files will live in the KISSmetricsAPI dir outside of any project. Projects will link to the shared KISSmetricsAPI dir.

Style:

  • Private vars - prefix with an underscore
  • Private methods - prefix with kma_
  • Unit test helper methods - prefix with uth_

Building:

  • Select KISSmetricsAPI Scheme > iPhone Simulator and Run
  • Select KISSmetricsSDK Scheme > iOS Device and Run
  • Select UniversaliOS Scheme > iOS Device and Run

You should find the compiled framework KISSmetricsAPI.framework in this repo's root dir.

32bit and 64bit architectures:

In order to support arm64, arm7, arm7s both the KISSmetricsAPI lib target and UniversaliOS aggregate target need to be built targeting iOS7 with Standard architectures (including 64-bit)(armv7, armv7s, arm64). To confirm that the these architectures were included in the final framework build, cd into the built KISSmetricsAPI.framework dir and run:

otool -V -f KISSmetricsSDK

Logging:

Internal logging for our own purposes.

Don't use NSLog, use KMALog which can be toggled by KMALogVerbose for release of our compiled SDK and only applies under DEBUG. (see KMAMacros.c)

We may wish to define a KMAInfoLog which will output logs to our customer devs. This should also have a verbose toggle that the customer dev can control.

Assertions:

Our SDK should always fail gracefully when not in DEBUG. Use KMAAssert over NSAssert to prevent assertions from our SDK when the customer's app has been built for release.

Only use KMAAssert for crucial warnings to the customer devs. Otherwise use NSLog or KMAInfoLog (if implemented)

Testing:

We're using OCMockito to aid in unit and application testing. https://github.com/jonreid/OCMockito

The KISSmetricsSDK_framework_builder includes a set of unit tests but because the framework builder is not an application, application tests of the framework are conducted under KISSmetricsSDK_buildFiles_arc_imp.

You should write your application tests in KISSmetricsSDK_buildFiles_arc_imp first rather than rebuilding the framework between each change to the SDK.

Category Extension:

Any category added to our SDK framework must use a unique name and every method within must also use a unique prefix to avoid conflicts with customer dev categories!

  • Use KMA as a class or constants prefix.
  • Use kmac_ for any public category methods.
  • Use kma_ as normal for any private methods.

Maintenance:

  1. Run all tests against each new release of iOS.
  2. As new iOS devices and device families are released, we'll need to add them to UIDevice+KMAHardware.
  3. Be sure to update the kKMAAPIUserAgent value of KMAArchiver with each update.

kissmetrics-ios-sdk's People

Contributors

lenards avatar willrust avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.