This page describes how to use the AMPLIFY Appcelerator Services Performance (APS) for native iOS applications, built with Objective-C and the iOS APIs.
The Appcelerator Performance service, powered by Apteligent, monitors your application's health, crashes and overall performance. Using Appcelerator Performance, developers are able to analyze crash reports to see why applications crashed and focus on the specific problems on user feedback.
Using Appcelerator Performance
To use the Appcelerator Performance service, add the APS framework to your project, then use the APSPerformance API to add breadcrumbs, user metadata and exception handling code to log events leading up to a crash. Login to the Appcelerator Dashboard and use the Appcelerator Performance dashboard to monitor application performance and analyze crash reports.
Setup Your Project
To integrate the Performance service with a new or existing iOS application:
- Go to the Dashboard and create a new native iOS application.
- Download the Services SDK and get your Performance application key.
- Unpack the
- Drag the
Appcelerator.frameworkfolder into your Xcode project's root folder if you are using Xcode 6 and above, or the
Frameworksfolder if you are using Xcode 5 or below.
- Select Copy items into destination… and click Finish.
- Select your project in the Project Navigator and click the Build Phases tab.
- Expand the Link Binary With Libraries section and add the
- Click the Build Settings tab, then click the All button in the top-left corner of the tab.
- Expand the Linking section and add
-ObjCto Other Linker Flags.
In your application delegate implementation file, import
In the application delegate's
application:didFinishLaunchingWithOptionsmethod, enable the service by calling the APSServiceManager's
The iOS application is now ready to make method calls using the
Create a Breadcrumb Trail
To make it easier to track the events leading up to a crash, use the
leaveBreadcrumb method to add breadcrumbs in your code. Place breadcrumbs near events and application state changes to track problematic paths that can lead to an application crash. Append variables to your breadcrumbs to track their state. For example:
These breadcrumbs are collected and passed to the Appcelerator Performance service. To view the breadcrumbs, in the Appcelerator Performance dashboard, when viewing a specific application, click either Crash Reports or Handled Exceptions. In the list of crashes or handled errors in the right pane, click on the crash or error to view its details. Click the Breadcrumbs tab to view the breadcrumb trails leading up to the crash or error.
The most recent 100 breadcrumbs are displayed before the crash occurred. A breadcrumb can be up to 140 characters.
Add User Metadata
To differentiate users of your application when viewing reports on the Appcelerator Performance dashboard, use the
username property to set the username of the session and use the
 subscription operator to leave custom metadata. For example:
The username appears with the crash or error reports. By default, a guest profile is created to differentiate users if a username is not specified. To retrieve this unique identifier, use the
To access the user metadata, either click on a username in a crash or error report to open a detailed view, or in the Appcelerator Performance dashboard, when viewing a specific application, click Search by User in the left pane then in the right pane, enter a user's name to find information about them.
Log An Exception
You can track handled exceptions in your application by passing an NSException object to the
logHandledException method, which can help identify and analyze potential errors and hot spots. For example:
Exception logs are useful for tracking crashes in third-party SDKs, code that syncs data between services, or detecting bad data that is returned from a server.
To view handled errors, in the Appcelerator Performance dashboard, when viewing a specific application, click Handled Exceptions in the left pane. A list of handled errors and statistics appears in the right pane. Click an error to view it in more detail.
Appcelerator Performance limits the logging of handled exceptions to one per minute. Up to five exceptions are buffered and are subsequently sent after the one minute limit.
Allow the User to Opt-Out
property to allow the user NOT to send any information to the Appcelerator Performance service. Passing
true to this method disables sending data to Appcelerator Performance.
Check for a Crash
didCrashOnLastAppLoad property to check if the application crashed in a previous session. If the property returns YES, the application crashed on the last session. Note that if
optOutStatus is set to YES, this method always returns NO.
For complete API information, see APSPerformance API.