UserVoice for iOS

Overview

UserVoice for iOS allows you to embed UserVoice directly in your iPhone or iPad app, allowing you to provide Instant Answers to your customers’ questions, a searchable knowledge base, and feedback forum. Our contact form is a friendlier experience than an email composer filled with debug information, and also eliminates those blank requests clogging up your inbox.

To get started, you will need to have a free UserVoice account to connect to. Go to uservoice.com/mobile/ to sign up for free.

Binary builds of the SDK are available for download: * Current release: 3.0.0 (updated 2013-12-31) * See CHANGELOG.md for release notes and previous versions

We also have an example app on GitHub that demonstrates how to build and integrate the SDK.

Upgrading from 2.0.x

  • You should pass your UVConfig to +[UserVoice initialize:] shortly after app launch so that we can provide you with accurate usage reports.
  • If you are using a custom stylesheet, you will need to update your code as both the set of options and the method of setting them have changed. See the section below on Customizing Colors.
  • You no longer need to pass a client key pair to UVConfig unless you have restricted access enabled on your UserVoice site.
  • We are dropping support for versions of iOS prior to 6.0.

Installation

  • Download the latest build.
  • Drag UVHeaders, UVResources, and libUserVoice.a into your project.
    • When adding the folders, make sure you have “Create groups for any added folders” selected rather than “Create folder references for any added folders”.
  • Note that the .h files in UVHeaders do not need to be added to your target.
  • Add QuartzCore and SystemConfiguration frameworks to your project.

See DEV.md if you want to build the SDK yourself.

CocoaPods

Alternatively, if you are using CocoaPods just add the following to your Podfile.

pod 'uservoice-iphone-sdk', '~> 3.0'

API

Once you have completed these steps, you are ready to launch the UserVoice UI from your code. Import UserVoice.h and create a UVConfig using one of the following options.

Configuration

Start by creating a UVConfig object like this:

UVConfig *config = [UVConfig configWithSite:@"yoursite.uservoice.com"];

Once you’ve set up your config the way you want it, you should go ahead and pass it to initialize:

[UserVoice initialize:config];

This should be called when your app starts up so that we can provide accurate metrics in your UserVoice admin console.

User identification

If you know who your user is, you can pass in their identity so that they won’t have to enter their name or email to send tickets or post ideas.

[config identifyUserWithEmail:@"user@example.com" name:@"Example User" guid:@"123"];

GUID can be the same as email, but if you have an internal user id, you can pass that so that the user’s account will have continuity if they later change their email address.

Note: One limitation is that this will not work if the email address matches an admin on your UserVoice account (for security reasons). Admins will still be able to use the iOS SDK but they will need to sign in the first time they do. If you are testing this feature, make sure you are not testing with an admin account.

Specify a forum

You can specify which forum users will interact with by id. If you do not specify a forum, it will use the default forum for your account.

config.forumId = 123;

Specify a help topic

You can also specify a help topic by id. If you don’t then it will display a list of all topics in your account, as long as they contain at least one article.

config.topicId = 123;

Custom Fields

You can set custom field values on the UVConfig object. These will be used associated with any tickets the user creates during their session. You can also use this to set default values for custom fields on the contact form.

Note: You must first configure these fields in the UserVoice admin console. If you pass fields that are not recognized by the server, they will be ignored.

config.customFields = @{@"Key" : @"Value"};

Toggle features

You can turn off certain features of the SDK if you do not want to use them. By default, all features are enabled if they are available on your account.

1. Turn off browsing the forum. The user will still be able to post ideas, and view ideas that they find by searching.

config.showForum = NO;

2. Turn off posting ideas. The user will still be able to browse and search existing ideas.

config.showPostIdea = NO;

3. Turn off the contact form.

config.showContactUs = NO;

4. Turn of the knowledge base. This only affects the knowledge base browser on the portal screen. Instant answers will still include articles.

config.showKnowledgeBase = NO;

If you deep-link to an area that is turned off (such as the contact form), it will still work. Turning off the feature only prevents it from being accessible anywhere in the UserVoice UI.

Invocation (Deep Linking)

There are 4 options for how to launch UserVoice from within your app:

1. Standard UserVoice Interface: This launches the UserVoice for iOS portal page where the user can browse suggestions, contact you or browse the knowledgebase. This is the full experience of everything the SDK can do.

[UserVoice presentUserVoiceInterfaceForParentViewController:self];

2. Direct link to contact form: Launches user directly into the contact form, with Instant Answers, experience. Useful to link to from error or setup pages in your app.

[UserVoice presentUserVoiceContactUsFormForParentViewController:self];

3. Direct link to feedback forum: Launches the user directly into the feedback forum where they can browse, vote on or give their own feedback. Useful for linking from a “Give us your ideas?” prompt from within your app.

[UserVoice presentUserVoiceForumForParentViewController:self];

4. Direct link to idea form: Launches user directly into the idea form, with Instant Answers, experience.

[UserVoice presentUserVoiceNewIdeaFormForParentViewController:self];

Passing user traits

You can optionally pass further information about your users into UserVoice. This will allow us to provide you more useful reports about your users.

config.userTraits = @{
  @"created_at" : @(1364406966),    // Unix timestamp for the date the user signed up
  @"type" : @"Owner",               // Optional: segment your users by type
  @"account" : @{
    @"id" : @(123),                 // Optional: associate multiple users with a single account
    @"name" : @"Acme, Co.",         // Account name
    @"created_at" : @(1364406966),  // Unix timestampe for the date the account was created
    @"monthly_rate" : @(9.99),      // Decimal; monthly rate of the account
    @"ltv" : @(1495.00),            // Decimal; lifetime value of the account
    @"plan" : @"Enhanced"           // Plan name for the account
  }
};

Customizing Colors

You can also customize the appearance of the UserVoice user interface by setting certain key colors.

1
2
3
#import "UVStyleSheet.h"
[UVStyleSheet instance].tintColor = [UIColor redColor];
[UVStyleSheet instance].tableViewBackgroundColor = [UIColor whiteColor];

See UVStyleSheet.h for a complete list of the visual properties you can modify.

User Language

The library will detect and display in the language the device is set to provided that language is supported by the SDK (see currently supported languages.).

Private Sites

The SDK relies on being able to obtain a client key to communicate with the UserVoice API. If you have a public UserVoice site (the default) then it can obtain this key automatically, so you only need to pass your site URL. However, if you turn on site privacy, this key is also private, so you will need to pass it in. You can obtain a client key pair from the mobile settings section of the UserVoice admin console.

1
2
UVConfig *config = [UVConfig configWithSite:@"yoursite.uservoice.com" andKey:@"CLIENT_KEY" andSecret:@"CLIENT_SECRET"];
[UserVoice initialize:config];

iOS Versions

  • UserVoice for iOS 3.0 is designed for iOS 7 with backwards compatibility for iOS 6
  • To support earlier versions you would have to go back to UserVoice for iOS 2.0