MSClient Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in MSClient.h

Overview

The MSClient class is the starting point for working with a Microsoft Azure Mobile Service on a client device. An instance of the MSClient class is created with a URL pointing to a Microsoft Azure Mobile Service. The MSClient allows the developer to get MSTable instances, which are used to work with the data of the Microsoft Azure Mobile Service, as well as login and logout an end user.

Properties

  applicationURL

The URL of the Microsoft Azure Mobile Service associated with the client.

@property (nonatomic, strong, readonly) NSURL *applicationURL

Discussion

The URL of the Microsoft Azure Mobile Service associated with the client.

Declared In

MSClient.h

  applicationKey

The application key for the Microsoft Azure Mobile Service associated with the client if one was provided in the creation of the client and nil otherwise. If non-nil, the application key will be included in all requests made to the Microsoft Azure Mobile Service, allowing the client to perform all actions on the Microsoft Azure Mobile Service that require application-key level permissions.

@property (nonatomic, copy, readonly) NSString *applicationKey

Discussion

The application key for the Microsoft Azure Mobile Service associated with the client if one was provided in the creation of the client and nil otherwise. If non-nil, the application key will be included in all requests made to the Microsoft Azure Mobile Service, allowing the client to perform all actions on the Microsoft Azure Mobile Service that require application-key level permissions.

Declared In

MSClient.h

  filters

A collection of MSFilter instances to apply to use with the requests and responses sent and received by the client. The property is readonly and the array is not-mutable. To apply a filter to a client, use the withFilter: method.

@property (nonatomic, strong, readonly) NSArray *filters

Discussion

A collection of MSFilter instances to apply to use with the requests and responses sent and received by the client. The property is readonly and the array is not-mutable. To apply a filter to a client, use the withFilter: method.

Declared In

MSClient.h

  syncContext

A sync context that defines how offline data is synced and allows for manually syncing data on demand

@property (nonatomic, strong) MSSyncContext *syncContext

Discussion

A sync context that defines how offline data is synced and allows for manually syncing data on demand

Declared In

MSClient.h

Registering and unregistering for push notifications

  push

The property to use for registering and unregistering for notifications via MSPush.

@property (nonatomic, strong, readonly) MSPush *push

Discussion

The property to use for registering and unregistering for notifications via MSPush.

Declared In

MSClient.h

  currentUser

The currently logged in user. While the currentUser property can be set directly, the login* and logout methods are more convenient and recommended for non-testing use.

@property (nonatomic, strong) MSUser *currentUser

Discussion

The currently logged in user. While the currentUser property can be set directly, the login* and logout methods are more convenient and recommended for non-testing use.

Declared In

MSClient.h

Initializing the MSClient Object

+ clientWithApplicationURLString:

Creates a client with the given URL for the Microsoft Azure Mobile Service.

+ (MSClient *)clientWithApplicationURLString:(NSString *)urlString

Discussion

Creates a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURLString:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (MSClient *)clientWithApplicationURLString:(NSString *)urlString applicationKey:(NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURLString:withApplicationKey:

Old method to create a client with the given URL and application key for the Microsoft Azure Mobile Service. This has been deprecated. Use clientWithApplicationURLString:applicationKey: @deprecated

+ (MSClient *)clientWithApplicationURLString:(NSString *)urlString withApplicationKey:(NSString *)key

Discussion

Old method to create a client with the given URL and application key for the Microsoft Azure Mobile Service. This has been deprecated. Use clientWithApplicationURLString:applicationKey: @deprecated

Declared In

MSClient.h

+ clientWithApplicationURL:

Creates a client with the given URL for the Microsoft Azure Mobile Service.

+ (MSClient *)clientWithApplicationURL:(NSURL *)url

Discussion

Creates a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

+ clientWithApplicationURL:applicationKey:

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

+ (MSClient *)clientWithApplicationURL:(NSURL *)url applicationKey:(NSString *)key

Discussion

Creates a client with the given URL and application key for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

– initWithApplicationURL:

Initializes a client with the given URL for the Microsoft Azure Mobile Service.

- (id)initWithApplicationURL:(NSURL *)url

Discussion

Initializes a client with the given URL for the Microsoft Azure Mobile Service.

Declared In

MSClient.h

– initWithApplicationURL:applicationKey:

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

- (id)initWithApplicationURL:(NSURL *)url applicationKey:(NSString *)key

Discussion

Initializes a client with the given URL and application key for the Windows Azure Mobile Service.

Declared In

MSClient.h

– clientWithFilter:

Creates a clone of the client with the given filter applied to the new client.

- (MSClient *)clientWithFilter:(id<MSFilter>)filter

Discussion

Creates a clone of the client with the given filter applied to the new client.

Declared In

MSClient.h

– loginWithProvider:controller:animated:completion:

Logs in the current end user with the given provider by presenting the MSLoginController with the given controller.

- (void)loginWithProvider:(NSString *)provider controller:(UIViewController *)controller animated:(BOOL)animated completion:(MSClientLoginBlock)completion

Discussion

Logs in the current end user with the given provider by presenting the MSLoginController with the given controller.

Declared In

MSClient.h

– loginViewControllerWithProvider:completion:

Returns an MSLoginController that can be used to log in the current end user with the given provider.

- (MSLoginController *)loginViewControllerWithProvider:(NSString *)provider completion:(MSClientLoginBlock)completion

Discussion

Returns an MSLoginController that can be used to log in the current end user with the given provider.

Declared In

MSClient.h

– loginWithProvider:token:completion:

Logs in the current end user with the given provider and the given token for the provider.

- (void)loginWithProvider:(NSString *)provider token:(NSDictionary *)token completion:(MSClientLoginBlock)completion

Discussion

Logs in the current end user with the given provider and the given token for the provider.

Declared In

MSClient.h

– logout

Logs out the current end user.

- (void)logout

Discussion

Logs out the current end user.

Declared In

MSClient.h

Querying Tables

– tableWithName:

Returns an MSTable instance for a table with the given name.

- (MSTable *)tableWithName:(NSString *)tableName

Discussion

Returns an MSTable instance for a table with the given name.

Declared In

MSClient.h

– getTable:

Old method to return an MSTable instance for a table with the given name. This has been deprecated. Use tableWithName:

- (MSTable *)getTable:(NSString *)tableName

Discussion

Old method to return an MSTable instance for a table with the given name. This has been deprecated. Use tableWithName:

Declared In

MSClient.h

– syncTableWithName:

Returns an MSSyncTable instance for a table with the given name.

- (MSSyncTable *)syncTableWithName:(NSString *)tableName

Discussion

Returns an MSSyncTable instance for a table with the given name.

Declared In

MSClient.h

Invoking Custom APIs

– invokeAPI:body:HTTPMethod:parameters:headers:completion:

Invokes a user-defined API of the Mobile Service. The HTTP request and response content will be treated as JSON.

- (void)invokeAPI:(NSString *)APIName body:(id)body HTTPMethod:(NSString *)method parameters:(NSDictionary *)parameters headers:(NSDictionary *)headers completion:(MSAPIBlock)completion

Discussion

Invokes a user-defined API of the Mobile Service. The HTTP request and response content will be treated as JSON.

Declared In

MSClient.h

– invokeAPI:data:HTTPMethod:parameters:headers:completion:

Invokes a user-defined API of the Mobile Service. The HTTP request and response content can be of any media type.

- (void)invokeAPI:(NSString *)APIName data:(NSData *)data HTTPMethod:(NSString *)method parameters:(NSDictionary *)parameters headers:(NSDictionary *)headers completion:(MSAPIDataBlock)completion

Discussion

Invokes a user-defined API of the Mobile Service. The HTTP request and response content can be of any media type.

Declared In

MSClient.h

Controlling connections to the server

  connectionDelegateQueue

Determines where connections made to the mobile service are run. If set, connection related logic will occur on this queue. Otherwise, the thread that made the call will be used.

@property (nonatomic, strong) NSOperationQueue *connectionDelegateQueue

Discussion

Determines where connections made to the mobile service are run. If set, connection related logic will occur on this queue. Otherwise, the thread that made the call will be used.

Declared In

MSClient.h