From e39002202b796f21ca431d44d377d725d3b9a2b5 Mon Sep 17 00:00:00 2001 From: Benjamin Reimold Date: Tue, 28 Apr 2015 16:14:42 +0200 Subject: [PATCH 1/2] All-new Readme --- README.md | 362 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 217 insertions(+), 145 deletions(-) diff --git a/README.md b/README.md index a1d9757a..1c0edc8f 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,77 @@ -## Application Insights for iOS (1.0-beta.1) +[![Build Status](https://travis-ci.org/Microsoft/ApplicationInsights-iOS.svg?branch=master)](https://travis-ci.org/Microsoft/ApplicationInsights-iOS) -**Release Notes** +# Application Insights for iOS (1.0-beta.2) -- Performance improvements -- Expose configuarations: - - Set serverURL programmatically - - Automatic page view tracking - - Set instrumentation key programmatically -- Bug fixes - - Use session id of previous session for crashes - - Session context for page views - - Prevent SDK from crashing if too many events are tracked -- Add user context to payload -- Breaking change: Rename MSAITelemetryManager to MSAITelemetryManager +This is the repository of the iOS SDK for Application Insights. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their applications available, performing, and succeeding. The SDK enables you to send telemetry of various kinds (events, traces, exceptions, etc.) to the Application Insights service where your data can be visualized in the Azure Portal. -## Introduction +The SDK runs on devices with iOS 6.0 or higher. -This article describes how to integrate Application Insights into your iOS apps. The SDK allows to send application metrics (events, traces, metrics, and pageviews) to the server. +## Content + +1. [Release Notes](#releasenotes) +2. [Breaking Changes](#breakingchanges) +3. [Requirements](#requirements) +4. [Setup](#setup) +5. [Advanced Setup](#advancedsetup) +6. [Developer Mode](#developermode) +7. [Basic Usage](#basicusage) +8. [Automatic collection of life-cycle events](#autolifecycle] +9. [Crash Reporting](#crashreporting) +10. [Additional Configuration](#additionalconfig) +11. [Documentation](#documentation) +12. [Contributing](#contributing) +13. [Contact](#contact) + +## 1. Release Notes + +* The size of the devices screen is now reported in physical pixels +* Renamed umbrella-class and product to **ApplicationInsights** +* Cleaned up code +* Removed previously deprecated methods and classes +* The order of stackframes is now reversed to appear in the portal correctly +* Developer Mode for more ease during development/debugging +* Includes Nullability warnings (learn more readin ([Apple's own blogpost]("https://developer.apple.com/swift/blog/?id=25") about this) +* Add gzip-support to dramatically decrease data volume used to send data to the server +* _Developer mode_ for ease of debugging +* Setting a custom server now requires the complete URL to the server (e.g. https://yourdomin/something/tracking/) + +## 2. Breaking Changes +Starting with the first 1.0 stable release, we will start deprecating API instead of breaking old ones. + +* **[1.0-beta.2]** ```MSAIAppInsights``` was the the central entry-point to use the Application Insights SDK. It has been renamed to ```MSAIApplicationInsights```. +* **[1.0-beta.2]** Setting the custom server URL now requires the complete URL to the server -This document contains the following sections: + +## 3. Requirements -- [Requirements](#requirements) -- [Download & Extract](#download) -- [Set up Xcode](#xcode) -- [Modify Code](#modify) -- [Endpoints](#endpoints) -- [iOS 8 Extensions](#extension) -- [Additional Options](#options) -- [Contact](#contact) +The SDK runs on devices with iOS 6.0 or higher. - -## Requirements +## 4. Setup -The SDK runs on devices with iOS 6.0 or higher. +We recommend integration of our binary into your Xcode project to setup Application Insights for your iOS app. For other ways to setup the SDK, see [Advanced Setup](#advancedsetup). - -## Download & Extract +### +### 4.1 Download the SDK -1. Download the latest [Application Insights for iOS](https://github.com/Microsoft/AppInsights-iOS/releases) framework. +1. Download the latest [Application Insights for iOS](https://github.com/Microsoft/AppInsights-iOS/releases) framework which is provided as a zip-File. +2. Unzip the file and you will see a folder called `ApplicationInsights` . -2. Unzip the file. A new folder `ApplicationInsights` is created. +### 4.2 Copy the SDK into your projects directory in Finder -3. Move the folder into your project directory. We usually put 3rd-party code into a subdirectory named `Vendor`, so we move the directory into it. +From our experience, 3rd-party libraries usually reside inside a subdirectory (let's call our subdirectory `Vendor`), so if you don't have your project orgainzed with a subdirectory for libraries, now would be a great start for it. To continue our example, create a folder called "Vendor" inside your project directory and move the unzipped `ApplicationInsights`-folder into it. - -## Set up Xcode +### +4.3 Set up the SDK in Xcode -1. Drag & drop `ApplicationInsights.framework` from your project directory to your Xcode project. -2. Similar to above, our projects have a group `Vendor`, so we drop it there. -3. Select `Create groups for any added folders` and set the checkmark for your target. Then click `Finish`. -4. Select your project in the `Project Navigator` (⌘+1). -5. Select your app target. -6. Select the tab `Build Phases`. -7. Expand `Link Binary With Libraries`. -8. Add the following system frameworks, if they are missing: +1. We recommend to use Xcode's group-feature to create a group for 3rd-party-lobraries similar to the structure of our files on disk. For example, similar to the file structure in 4.1 above, our projects have a group called `Vendor`. +2. Make sure the `Project Navigator` is visible (⌘+1) +3. Drag & drop `ApplicationInsights.framework` from your window in the `Finder` into your project in Xcode and move it to the desired location in the `Project Navigator` (e.g. into the group called `Vendor`) +4. A popup will appear. Select `Create groups for any added folders` and set the checkmark for your target. Then click `Finish`. +5. Select your project in the `Project Navigator` (⌘+1). +6. Select your app target. +7. Select the tab `Build Phases`. +8. Expand `Link Binary With Libraries`. +9. Add the following system frameworks, if they are missing: - `UIKit` - `Foundation` - `SystemConfiguration` @@ -62,19 +80,18 @@ The SDK runs on devices with iOS 6.0 or higher. - `CoreTelephony`(only required if iOS > 7.0) 9. Open the info.plist of your app target and add a new field of type *String*. Name it `MSAIInstrumentationKey` and set your Application Insights instrumentation key as its value. - -## Modify Code +### 4.4 Modify Code -### Objective-C +**Objective-C** -2. Open your `AppDelegate.m` file. -3. Add the following line at the top of the file below your own #import statements: +1. Open your `AppDelegate.m` file. +2. Add the following line at the top of the file below your own #import statements: ```objectivec #import ``` -4. Search for the method `application:didFinishLaunchingWithOptions:` -5. Add the following lines to setup and start the Application Insights SDK: +3. Search for the method `application:didFinishLaunchingWithOptions:` +4. Add the following lines to setup and start the Application Insights SDK: ```objectivec [[MSAIApplicationInsights sharedInstance] setup]; @@ -83,112 +100,79 @@ The SDK runs on devices with iOS 6.0 or higher. [[MSAIApplicationInsights sharedInstance] start]; ``` - You can also use the following shortcut: + You can also use the following shortcuts: ```objectivec [MSAIApplicationInsights setup]; [MSAIApplicationInsights start]; ``` -6. Send some data to the server: - - ```objectivec - // Send an event with custom properties and measuremnts data - [MSAITelemetryManager trackEventWithName:@"Hello World event!" - properties:@{@"Test property 1":@"Some value", - @"Test property 2":@"Some other value"} - measurements:@{@"Test measurement 1":@(4.8), - @"Test measurement 2":@(15.16), - @"Test measurement 3":@(23.42)}]; - - // Send a message - [MSAITelemetryManager trackTraceWithMessage:@"Test message"]; - - // Manually send pageviews (note: this will also be done automatically) - [MSAITelemetryManager trackPageView:@"MyViewController" - duration:300 - properties:@{@"Test measurement 1":@(4.8)}]; - - // Send custom metrics - [MSAITelemetryManager trackMetricWithName:@"Test metric" - value:42.2]; - ``` - -*Note:* The SDK is optimized to defer everything possible to a later time while making sure e.g. crashes on startup can also be caught and each module executes other code with a delay some seconds. This ensures that applicationDidFinishLaunching will process as fast as possible and the SDK will not block the startup sequence resulting in a possible kill by the watchdog process. +**Swift** -### Swift - -2. Open your `AppDelegate.swift` file. -3. Add the following line at the top of the file below your own #import statements: +1. Open your `AppDelegate.swift` file. +2. Add the following line at the top of the file below your own #import statements: ```swift #import ApplicationInsights ``` -4. Search for the method +3. Search for the method ```swift application(application: UIApplication, didFinishLaunchingWithOptions launchOptions:[NSObject: AnyObject]?) -> Bool` ``` -5. Add the following lines to setup and start the Application Insights SDK: +4. Add the following lines to setup and start the Application Insights SDK: ```swift MSAIApplicationInsights.sharedInstance().setup(); MSAIApplicationInsights.sharedInstance().start(); ``` - You can also use the following shortcut: + You can also use the following shortcuts: ```swift MSAIApplicationInsights.setup(); MSAIApplicationInsights.start(); ``` -5. Send some data to the server: - ```swift - // Send an event with custom properties and measuremnts data - MSAITelemetryManager.trackEventWithName(name:"Hello World event!", - properties:@{"Test property 1":"Some value", - "Test property 2":"Some other value"}, - measurements:@{"Test measurement 1":@(4.8), - "Test measurement 2":@(15.16), - "Test measurement 3":@(23.42)}); +**Congratulation, now you're all set to use Application Insights! See [Basic Usage](#basicusage) on how to use Application Insights.** - // Send a message - MSAITelemetryManager.trackTraceWithMessage(message:"Test message"); - // Manually send pageviews - MSAITelemetryManager.trackPageView(pageView:"MyViewController", - duration:300, - properties:@{"Test measurement 1":@(4.8)}); +## 5. Advanced Setup - // Send a message - MSAITelemetryManager.trackMetricWithName(name:"Test metric", - value:42.2); - ``` +### 5.1 Set Instrumentation Key in Code - -## Endpoint +It is also possible to set the instrumentation key of your app in code. This will override the one you might have set in your `info.plist`. Do set it in code, MSAIApplicationInsights provides an overloaded constructor: -By default the following server URL is used to work with the [Azure portal](https://portal.azure.com): +```objectivec + [MSAIApplicationInsights setupWithInstrumentationKey:@"{YOUR-INSTRUMENTATION-KEY}"]; + + //Do additional configuration -* `https://dc.services.visualstudio.com` +MSAIApplicationInsights start]; +``` -To change the URL, setup Application Insights like this: -```objectivec - [[MSAIApplicationInsights sharedInstance] setup]; - [[MSAIApplicationInsights sharedInstance] setServerURL:{your server url}]; - [[MSAIApplicationInsights sharedInstance] start]; +### 5.2 Setup with CocoaPods + +[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like ApplicationInsights in your projects. To learn how to setup cocoapods for your project, visit the [official cocoapods website](http://cocoapods.org/). + +**[NOTE]** +When adding Application Insights to your podfile **without** specifying the version, `pod install` will throw an error because using a pre-release version of a pod has to be specified **explicitly**. +As soon as Application Insights 1.0 is available, the version doesn't have to be specified in your podfile anymore. + +**Podfile** + +```ruby +platform :ios, '8.0' +pod "ApplicationInsights", '1.0-beta.2' ``` - - -## iOS 8 Extensions +### 5.3 iOS 8 Extensions The following points need to be considered to use the Application Insights SDK with iOS 8 Extensions: 1. Each extension is required to use the same values for version (`CFBundleShortVersionString`) and build number (`CFBundleVersion`) as the main app uses. (This is required only if you are using the same `MSAIInstrumentationKey` for your app and extensions). -2. You need to make sure the SDK setup code is only invoked once. Since there is no `applicationDidFinishLaunching:` equivalent and `viewDidLoad` can run multiple times, you need to use a setup like the following example: +2. You need to make sure the SDK setup code is only invoked **once**. Since there is no `applicationDidFinishLaunching:` equivalent and `viewDidLoad` can run multiple times, you need to use a setup like the following example: ```objectivec @interface TodayViewController () @@ -206,58 +190,146 @@ The following points need to be considered to use the Application Insights SDK w } } ``` + +## 6. Developer Mode + +###6.1 Batching of data + +The **developer mode** is enabled automatically in case the debugger is attached or if the app is running in the emulator. This will decrease the number of telemetry items sent in a batch (5 items) as well as the interval items when telemetry will be sent (3 seconds). + +###6.2 Logging + +We're all big fans of a clean debugging output without 3rd-party-SDKs messages pilling up in the debugging view, right?! +That's why Application Insights keeps log messages to a minimum (like critical errors) unless the developer specifically enables before starting the SDK: + + ```objectivec +[MSAIApplicationInsights setup]; //setup the SDK - -## Additional Options +[[MSAIApplicationInsights sharedInstance] setDebugLogEnabled:YES]; //enable debug logging + +[MSAIApplicationInsights start]; //start using the SDK + +``` + +This setting is ignored if the app is running in an appstore environment, so the user's console won't be littered with our log messages. -### Set up with xcconfig +## 7. Basic Usage -Instead of manually adding the missing frameworks, you can also use our bundled xcconfig file. +**[NOTE]** The SDK is optimized to defer everything possible to a later time while making sure e.g. crashes on startup can also be caught and each module executes other code with a delay some seconds. This ensures that applicationDidFinishLaunching will process as fast as possible and the SDK will not block the startup sequence resulting in a possible kill by the watchdog process. -1. Select your project in the `Project Navigator` (⌘+1). +After you have setup the SDK as [described above](#setup), the ```MSAITelemetryManager```-instance is the central interface to track events, traces, metrics, page views or handled exceptions. -2. Select your project. +### 7.1 Objective-C -3. Select the tab `Info`. + ```objectivec + + // Send an event with custom properties and measurements data + [MSAITelemetryManager trackEventWithName:@"Hello World event!" + properties:@{@"Test property 1":@"Some value", + @"Test property 2":@"Some other value"} + measurements:@{@"Test measurement 1":@(4.8), + @"Test measurement 2":@(15.16), + @"Test measurement 3":@(23.42)}]; -4. Expand `Configurations`. + // Send a message + [MSAITelemetryManager trackTraceWithMessage:@"Test message"]; -5. Select `ApplicationInsights.xcconfig` for all your configurations (if you don't already use a `.xcconfig` file) + // Manually send pageviews (note: this will also be done automatically) + [MSAITelemetryManager trackPageView:@"MyViewController" + duration:300 + properties:@{@"Test measurement 1":@(4.8)}]; - **Note:** You can also add the required frameworks manually to your targets `Build Phases` and continue with step `7.` instead. + // Send custom metrics + [MSAITelemetryManager trackMetricWithName:@"Test metric" + value:42.2]; + ``` -6. If you are already using a `.xcconfig` file, simply add the following line to it - `#include "../Vendor/ApplicationInsights/Support/ApplicationInsights.xcconfig"` +### 7.2 Swift + + ```swift + // Send an event with custom properties and measuremnts data + MSAITelemetryManager.trackEventWithName(name:"Hello World event!", + properties:@{"Test property 1":"Some value", + "Test property 2":"Some other value"}, + measurements:@{"Test measurement 1":@(4.8), + "Test measurement 2":@(15.16), + "Test measurement 3":@(23.42)}); - (Adjust the path depending where the `Project.xcconfig` file is located related to the Xcode project package) + // Send a message + MSAITelemetryManager.trackTraceWithMessage(message:"Test message"); - **Important note:** Check if you overwrite any of the build settings and add a missing `$(inherited)` entry on the projects build settings level, so the `ApplicationInsights.xcconfig` settings will be passed through successfully. + // Manually send pageviews + MSAITelemetryManager.trackPageView(pageView:"MyViewController", + duration:300, + properties:@{"Test measurement 1":@(4.8)}); -7. If you are getting build warnings, then the `.xcconfig` setting wasn't included successfully or its settings in `Other Linker Flags` get ignored because `$(inherited)` is missing on project or target level. Either add `$(inherited)` or link the following frameworks manually in `Link Binary With Libraries` under `Build Phases`: - - `UIKit` - - `Foundation` - - `SystemConfiguration` - - `Security` - - `libz` - - `CoreTelephony`(only required if iOS > 7.0) + // Send a message + MSAITelemetryManager.trackMetricWithName(name:"Test metric", + value:42.2); + ``` -### Setup with CocoaPods +## 8. Automatic collection of life-cycle events (Sessions & Page Views) -[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like ApplicationInsights in your projects. To learn how to setup cocoapods for your project, visit the [official cocoapods website](http://cocoapods.org/). +Automatic collection of life-cycle events is **enabled by default**. This means that Application Insights automatically tracks the appearance of a viewcontroller for you. It also manages the user sessions for you with a background-time sat to 20 seconds, so if the user has backgrounded your app for more than 20s, it counts as a new session. -**[NOTE]** -When adding Application Insights to your podfile **without** specifying the version, `pod install` will throw an error because using a pre-release version of a pod has to be specified **explicitly**. -As soon as Application Insights 1.0 is available, the version doesn't have to be specified in your podfile anymore. +This feature can be disabled between setup and start of the SDK. -#### Podfile + ```objectivec +[MSAIApplicationInsights setup]; //setup the SDK + + [[MSAIApplicationInsights sharedInstance] setAutoPageViewTrackingDisabled:YES]; //disable the auto collection + +[MSAIApplicationInsights start]; //start using the SDK + +``` + +## 9. Crash Reporting + +The Application Insights SDK enables crash reporting **per default**. Crashes will be immediately sent to the server if a connection is available. +To provide you with the best crash reporting, we are using [PLCrashReporter]("https://github.com/plausiblelabs/plcrashreporter") in [Version 1.2]("https://github.com/plausiblelabs/plcrashreporter/tree/release/plcrashreporter-1.2"). + +This feature can be disabled as follows: + +```objectivec +[MSAIApplicationInsights setup]; //setup the SDK + +[[MSAIApplicationInsights sharedInstance] setCrashManagerDisabled:YES]; //disable crash reporting + +[MSAIApplicationInsights start]; //start using the SDK + +``` + +## 10. Set Custom Server Endpoint + +You can also configure a different server endpoint for the SDK if needed using a full URL + +```objectivec +[MSAIApplicationInsights setup]; //setup the SDK + +[[MSAIApplicationInsights sharedInstance] setServerURL:@"https://YOURDOMAIN/path/subpath"]; + +[MSAIApplicationInsights start]; //start using the SDK -```ruby -platform :ios, '8.0' -pod "ApplicationInsights", '1.0-beta.1' ``` + +### 11. Documentation + +Our documentation can be found on [CocoaDocs](http://cocoadocs.org/docsets/ApplicationInsights/1.0-beta.2/) + + + +### 12. Contributing + +We're looking forward to your contributions via pull requests. + +**Development environment** +* Mac running the latest version of OS X +* Get the latest Xcode from the Mac App Store +* Install [AppleDoc](https://github.com/tomaz/appledoc) +* -## Contact +## 13. Contact If you have further questions or are running into trouble that cannot be resolved by any of the steps here, feel free to contact us at [AppInsights-iOS@microsoft.com](mailto:AppInsights-ios@microsoft.com) From 23c22d69d6574794f76e5d00d78f64c1549e9f1f Mon Sep 17 00:00:00 2001 From: Benjamin Reimold Date: Tue, 28 Apr 2015 16:29:34 +0200 Subject: [PATCH 2/2] Fix layout of code samples --- README.md | 104 ++++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 1c0edc8f..f07ccbfa 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ The SDK runs on devices with iOS 6.0 or higher. 5. [Advanced Setup](#advancedsetup) 6. [Developer Mode](#developermode) 7. [Basic Usage](#basicusage) -8. [Automatic collection of life-cycle events](#autolifecycle] +8. [Automatic collection of life-cycle events](#autolifecycle) 9. [Crash Reporting](#crashreporting) -10. [Additional Configuration](#additionalconfig) +10. [Set Custom Server Endpoint](#additionalconfig) 11. [Documentation](#documentation) 12. [Contributing](#contributing) 13. [Contact](#contact) @@ -60,8 +60,7 @@ We recommend integration of our binary into your Xcode project to setup Applicat From our experience, 3rd-party libraries usually reside inside a subdirectory (let's call our subdirectory `Vendor`), so if you don't have your project orgainzed with a subdirectory for libraries, now would be a great start for it. To continue our example, create a folder called "Vendor" inside your project directory and move the unzipped `ApplicationInsights`-folder into it. -### -4.3 Set up the SDK in Xcode +### 4.3 Set up the SDK in Xcode 1. We recommend to use Xcode's group-feature to create a group for 3rd-party-lobraries similar to the structure of our files on disk. For example, similar to the file structure in 4.1 above, our projects have a group called `Vendor`. 2. Make sure the `Project Navigator` is visible (⌘+1) @@ -202,13 +201,12 @@ The **developer mode** is enabled automatically in case the debugger is attached We're all big fans of a clean debugging output without 3rd-party-SDKs messages pilling up in the debugging view, right?! That's why Application Insights keeps log messages to a minimum (like critical errors) unless the developer specifically enables before starting the SDK: - ```objectivec +```objectivec [MSAIApplicationInsights setup]; //setup the SDK [[MSAIApplicationInsights sharedInstance] setDebugLogEnabled:YES]; //enable debug logging [MSAIApplicationInsights start]; //start using the SDK - ``` This setting is ignored if the app is running in an appstore environment, so the user's console won't be littered with our log messages. @@ -221,53 +219,51 @@ After you have setup the SDK as [described above](#setup), the ```MSAITelemetryM ### 7.1 Objective-C - ```objectivec - - // Send an event with custom properties and measurements data - [MSAITelemetryManager trackEventWithName:@"Hello World event!" - properties:@{@"Test property 1":@"Some value", - @"Test property 2":@"Some other value"} - measurements:@{@"Test measurement 1":@(4.8), - @"Test measurement 2":@(15.16), - @"Test measurement 3":@(23.42)}]; - - // Send a message - [MSAITelemetryManager trackTraceWithMessage:@"Test message"]; - - // Manually send pageviews (note: this will also be done automatically) - [MSAITelemetryManager trackPageView:@"MyViewController" - duration:300 - properties:@{@"Test measurement 1":@(4.8)}]; - - // Send custom metrics - [MSAITelemetryManager trackMetricWithName:@"Test metric" - value:42.2]; - ``` +```objectivec +// Send an event with custom properties and measurements data +[MSAITelemetryManager trackEventWithName:@"Hello World event!" + properties:@{@"Test property 1":@"Some value", + @"Test property 2":@"Some other value"} + measurements:@{@"Test measurement 1":@(4.8), + @"Test measurement 2":@(15.16), + @"Test measurement 3":@(23.42)}]; + +// Send a message +[MSAITelemetryManager trackTraceWithMessage:@"Test message"]; + +// Manually send pageviews (note: this will also be done automatically) +[MSAITelemetryManager trackPageView:@"MyViewController" + duration:300 + properties:@{@"Test measurement 1":@(4.8)}]; + +// Send custom metrics +[MSAITelemetryManager trackMetricWithName:@"Test metric" value:42.2]; +``` ### 7.2 Swift - ```swift - // Send an event with custom properties and measuremnts data - MSAITelemetryManager.trackEventWithName(name:"Hello World event!", - properties:@{"Test property 1":"Some value", - "Test property 2":"Some other value"}, - measurements:@{"Test measurement 1":@(4.8), - "Test measurement 2":@(15.16), - "Test measurement 3":@(23.42)}); - - // Send a message - MSAITelemetryManager.trackTraceWithMessage(message:"Test message"); - - // Manually send pageviews - MSAITelemetryManager.trackPageView(pageView:"MyViewController", - duration:300, - properties:@{"Test measurement 1":@(4.8)}); - - // Send a message - MSAITelemetryManager.trackMetricWithName(name:"Test metric", - value:42.2); - ``` + +```swift +// Send an event with custom properties and measuremnts data +MSAITelemetryManager.trackEventWithName(name:"Hello World event!", + properties:@{"Test property 1":"Some value", + "Test property 2":"Some other value"}, + measurements:@{"Test measurement 1":@(4.8), + "Test measurement 2":@(15.16), + "Test measurement 3":@(23.42)}); + +// Send a message +MSAITelemetryManager.trackTraceWithMessage(message:"Test message"); + +// Manually send pageviews +MSAITelemetryManager.trackPageView(pageView:"MyViewController", + duration:300, + properties:@{"Test measurement 1":@(4.8)}); + +// Send a message +MSAITelemetryManager.trackMetricWithName(name:"Test metric", value:42.2); +``` ## 8. Automatic collection of life-cycle events (Sessions & Page Views) @@ -275,10 +271,10 @@ Automatic collection of life-cycle events is **enabled by default**. This means This feature can be disabled between setup and start of the SDK. - ```objectivec +```objectivec [MSAIApplicationInsights setup]; //setup the SDK - [[MSAIApplicationInsights sharedInstance] setAutoPageViewTrackingDisabled:YES]; //disable the auto collection +[[MSAIApplicationInsights sharedInstance] setAutoPageViewTrackingDisabled:YES]; //disable the auto collection [MSAIApplicationInsights start]; //start using the SDK @@ -287,7 +283,7 @@ This feature can be disabled between setup and start of the SDK. ## 9. Crash Reporting The Application Insights SDK enables crash reporting **per default**. Crashes will be immediately sent to the server if a connection is available. -To provide you with the best crash reporting, we are using [PLCrashReporter]("https://github.com/plausiblelabs/plcrashreporter") in [Version 1.2]("https://github.com/plausiblelabs/plcrashreporter/tree/release/plcrashreporter-1.2"). +To provide you with the best crash reporting, we are using [PLCrashReporter]("https://github.com/plausiblelabs/plcrashreporter") in [Version 1.2 / Commit 273a7e7cd4b77485a584ac82e77b7c857558e2f9]("https://github.com/plausiblelabs/plcrashreporter/commit/273a7e7cd4b77485a584ac82e77b7c857558e2f9"). This feature can be disabled as follows: @@ -313,13 +309,13 @@ You can also configure a different server endpoint for the SDK if needed using a ``` -### 11. Documentation +## 11. Documentation Our documentation can be found on [CocoaDocs](http://cocoadocs.org/docsets/ApplicationInsights/1.0-beta.2/) -### 12. Contributing +## 12. Contributing We're looking forward to your contributions via pull requests.