DBAccountManager Class Reference
Inherits from | NSObject |
Declared in | DBAccountManager.h |
Overview
The account manager is responsible for linking new users and persisting account information across runs of your app. You typically create an account manager at app startup with your app key and secret and keep it until your app terminates.
Tasks
Creating an account manager
-
– initWithAppKey:secret:
Create a new account manager with your app’s app key and secret. You can register your app or find your key at the apps page. Note that right now only apps with the App Folder permission can use the Sync API.
-
+ setSharedManager:
A convenient place to store your app’s account manager.
-
+ sharedManager
A convenient place to get your app’s account manager.
Linking new accounts
-
– linkFromController:
This method begins the process for linking new accounts.
-
– handleOpenURL:
You must call this method in your app delegate’s
-application:openURL:sourceApplication:annotation:
method in order to complete the link process.
Getting the current state
-
linkedAccount
The currently linked account, or
propertynil
if there are no accounts currently linked.
Watching for changes
-
– addObserver:block:
Add
block
as an observer to get called whenever a new account is linked or an existing account is unlinked. -
– removeObserver:
Use this method to remove all blocks associated with
observer
.
Class Methods
Instance Methods
addObserver:block:
Add block
as an observer to get called whenever a new account is linked or an existing
account is unlinked.
- (void)addObserver:(id)observer block:(DBAccountManagerObserver)block
Parameters
- observer
this is only used as a handle to unregister blocks with the removeObserver: method.
Declared In
DBAccountManager.h
handleOpenURL:
You must call this method in your app delegate’s
-application:openURL:sourceApplication:annotation:
method in order to complete the link process.
- (DBAccount *)handleOpenURL:(NSURL *)url
Return Value
The account object if the link was successful, or nil
if the user
cancelled.
Declared In
DBAccountManager.h
initWithAppKey:secret:
Create a new account manager with your app’s app key and secret. You can register your app or find your key at the apps page. Note that right now only apps with the App Folder permission can use the Sync API.
- (id)initWithAppKey:(NSString *)key secret:(NSString *)secret
Declared In
DBAccountManager.h
linkFromController:
This method begins the process for linking new accounts.
- (void)linkFromController:(UIViewController *)rootController
Parameters
- rootController
the topmost view controller in your controller hierarchy.
Declared In
DBAccountManager.h
removeObserver:
Use this method to remove all blocks associated with observer
.
- (void)removeObserver:(id)observer
Parameters
- observer
the same value you provided to the addObserver:block: method.
Declared In
DBAccountManager.h