Heap for iOS
Heap is a modern take on analytics. There's no need to ship event tracking code, no need to wait days or weeks for data to accumulate, no need to muddle your codebase, and no need to fumble with rigid reports.
For the first time, meaningful product questions can be answered just as soon as they're asked.
See CHANGELOG.md
for what's new.
Installation
We recommend using Cocoapods to quickly and easily add Heap:
- Install Cocoapods by running
sudo gem install cocoapods
. - Create a file in your Xcode project directory called
Podfile
. - Add the following line to your Podfile:
pod 'Heap'
- Run
pod install
within your Xcode project directory. - Initialize Heap with your app ID. We recommend doing this in
applicationDidFinishLaunching:
orapplication:didFinishLaunchingWithOptions:
in your Application delegate as follows:
#import "Heap.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Heap initialize:@"YOUR_APP_ID"];
#ifdef DEBUG
[Heap enableVisualizer];
#endif
/* Other launch code goes here */
return YES;
}
- Make sure you open the file with the extension .xcworkspace
Or you can install Heap manually:
- Download the Heap iOS library.
- Unzip the downloaded file and drag
libHeap.a
andHeap.h
into your XCode project. Make sure to select Copy items if needed. - Click on the project (blue project icon), and select "Build Settings".
- Within Build Settings, change "Other Linker Flags" to include
-all_load -ObjC
as a flag. - Link your app to these libraries: * CFNetwork.framework * Foundation.framework * libicucore.tbd * Security.framework * SystemConfiguration * UIKit
- Initialize Heap with your app ID, as illustrated in the code snippet above.
Using Heap with Swift
The Heap library should work fine if you use an Objective-C bridge header with your Swift project.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Heap.initialize("YOUR_APP_ID");
#if DEBUG
Heap.enableVisualizer();
#endif
return true
}
Using Heap with iMessage Apps
Heap should work with standalone iMessage apps if you override didBecomeActive
.
func didBecomeActive(with conversation: MSConversation) {
Heap.initialize("YOUR_APP_ID");
#if DEBUG
Heap.enableVisualizer();
#endif
}
Having trouble with iOS installation? Here are solutions for common problems.