EvernoteSession Class Reference
| Inherits from | NSObject |
| Conforms to | ENOAuthViewControllerDelegate SKStoreProductViewControllerDelegate |
| Declared in | EvernoteSession.h EvernoteSession.m |
Overview
The EvernoteSession class provides a centralized place for authentication and gives access to the EvernoteNoteStore and EvernoteUserStore objects. Every application must have exactly one instance of EvernoteSession. When an application is ready, the application:didFinishLaunchingWithOptions: function is called, where you should call the class method setSharedSessionHost:consumerKey:consumerSecret:supportedService: Thereafter you can access this object by invoking the sharedSession class method.
Tasks
Other Methods
-
delegateThe delegate of the Evernote session
property
Session data
-
stateThe detailed state of the session
property -
isAuthenticatedDetermines whether this session is authenticated or not.
property -
authenticationTokenEvernote auth token, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
property -
businessAuthenticationTokenEvernote auth token for Business, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
property -
userStoreUrlURL for the Evernote UserStore.
property -
noteStoreUrlURL for the Evernote NoteStore for the authenticated user. Will only be non-nil once we’ve authenticated.
property -
webApiUrlPrefixURL prefix for the web API. Will only be non-nil once we’ve authenticated.
property -
queueShared dispatch queue for API operations.
property -
profilesAll the bootstrap profiles for the user.
property -
businessUserThe business user object.
property
Session handling
-
+ setSharedSessionHost:consumerKey:consumerSecret:Set up the shared session.
-
+ sharedSession- Get the singleton shared session.
-
– canHandleOpenURL:Handle open url from the Evernote app.
-
– handleDidBecomeActiveApplication became active as a result of app switching.
-
– authenticateWithViewController:completionHandler:Authenticate, calling the given handler upon completion.
-
– isEvernoteInstalledCheck if the Evernote app is installed.
-
– logoutLogout and clear authentication.
Accessing user and notes data
-
– userStoreCreate a new UserStore client for EDAM calls.
-
– noteStoreCreate a new NoteStore client for EDAM calls.
-
– businessNoteStoreCreate a new NoteStore client for EDAM calls.
-
– noteStoreWithNoteStoreURL:Create a new NoteStore client for EDAM calls.
-
– updateCurrentBootstrapProfileWithName:Change the bootstrap profile.
-
– installEvernoteAppUsingViewController:Install the evernote for iOS app.
Properties
authenticationToken
Evernote auth token, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
@property (weak, nonatomic, readonly) NSString *authenticationTokenDiscussion
Evernote auth token, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
Declared In
EvernoteSession.hbusinessAuthenticationToken
Evernote auth token for Business, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
@property (weak, nonatomic, readonly) NSString *businessAuthenticationTokenDiscussion
Evernote auth token for Business, to be passed to any NoteStore methods. Will only be non-nil once we’ve authenticated.
Declared In
EvernoteSession.hbusinessUser
The business user object.
@property (nonatomic, strong) EDAMUser *businessUserDiscussion
The business user object.
Declared In
EvernoteSession.hdelegate
The delegate of the Evernote session
@property (nonatomic, assign) id<ENSessionDelegate> delegateDiscussion
The delegate of the Evernote session
Declared In
EvernoteSession.hisAuthenticated
Determines whether this session is authenticated or not.
@property (nonatomic, readonly) BOOL isAuthenticatedDiscussion
Determines whether this session is authenticated or not.
Declared In
EvernoteSession.hnoteStoreUrl
URL for the Evernote NoteStore for the authenticated user. Will only be non-nil once we’ve authenticated.
@property (weak, nonatomic, readonly) NSString *noteStoreUrlDiscussion
URL for the Evernote NoteStore for the authenticated user. Will only be non-nil once we’ve authenticated.
Declared In
EvernoteSession.hprofiles
All the bootstrap profiles for the user.
@property (nonatomic, strong) NSArray *profilesDiscussion
All the bootstrap profiles for the user.
Declared In
EvernoteSession.hqueue
Shared dispatch queue for API operations.
@property (nonatomic, readonly) dispatch_queue_t queueDiscussion
Shared dispatch queue for API operations.
Declared In
EvernoteSession.hstate
The detailed state of the session
@property (readonly) ENSessionState stateDiscussion
The detailed state of the session
Declared In
EvernoteSession.hClass Methods
setSharedSessionHost:consumerKey:consumerSecret:
Set up the shared session.
+ (void)setSharedSessionHost:(NSString *)host consumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecretParameters
- host
The server URL. “sandbox.yinxiang.com” should be used for testing .“www.evernote.com” for production apps.
- consumerKey
The consumer key. Get your consumer key here.
- consumerSecret
The consumer secret.
Discussion
Set up the shared session.
This should be called as soon as the application is ready to run.
Declared In
EvernoteSession.hInstance Methods
authenticateWithViewController:completionHandler:
Authenticate, calling the given handler upon completion.
- (void)authenticateWithViewController:(UIViewController *)viewController completionHandler:(EvernoteAuthCompletionHandler)completionHandlerParameters
- viewController
The view controller that should be used to present the authentication view
- completionHandler
This block will be called once the authentication process is completed with sucess or failure.
Discussion
Authenticate, calling the given handler upon completion.
This should be called to kick off the authentication process with Evernote.
Declared In
EvernoteSession.hbusinessNoteStore
Create a new NoteStore client for EDAM calls.
- (EDAMNoteStoreClient *)businessNoteStoreReturn Value
Returns the note store client.
Discussion
Create a new NoteStore client for EDAM calls.
This lets you make API calls for all the data in the user’s business account. This also handles authentication to business, as long as the Evernote session is authenticated. This function may throw an NSException. The returned object is NOT thread safe.
Declared In
EvernoteSession.hcanHandleOpenURL:
Handle open url from the Evernote app.
- (BOOL)canHandleOpenURL:(NSURL *)urlParameters
- url
The URL passed from the AppDelegate
Discussion
Handle open url from the Evernote app.
This will used during authentication and should be called from the AppDelegate class.
Declared In
EvernoteSession.hhandleDidBecomeActive
Application became active as a result of app switching.
- (void)handleDidBecomeActiveDiscussion
Application became active as a result of app switching.
This will be used to handle unexpected events due to app switching.
Declared In
EvernoteSession.hinstallEvernoteAppUsingViewController:
Install the evernote for iOS app.
- (void)installEvernoteAppUsingViewController:(UIViewController *)viewControllerParameters
- viewController
The view controller that should be used as a base controller to present this view controller.
Discussion
Install the evernote for iOS app.
This can be used to present the user with a dialog to install the Evernote for iOS app
Declared In
EvernoteSession.hisEvernoteInstalled
Check if the Evernote app is installed.
- (BOOL)isEvernoteInstalledDiscussion
Check if the Evernote app is installed.
Checks if the Evernote for IOS app is installed on the user’s device
Declared In
EvernoteSession.hlogout
Logout and clear authentication.
- (void)logoutDiscussion
Logout and clear authentication.
This will clear all the cookies as well.
Declared In
EvernoteSession.hnoteStore
Create a new NoteStore client for EDAM calls.
- (EDAMNoteStoreClient *)noteStoreReturn Value
Returns the note store client.
Discussion
Create a new NoteStore client for EDAM calls.
This lets you make API calls for all the data. This function may throw an NSException. The returned object is NOT thread safe.
Declared In
EvernoteSession.hnoteStoreWithNoteStoreURL:
Create a new NoteStore client for EDAM calls.
- (EDAMNoteStoreClient *)noteStoreWithNoteStoreURL:(NSString *)noteStoreURLParameters
- noteStoreURL
The URL of the note store.
Return Value
Returns the note store client.
Discussion
Create a new NoteStore client for EDAM calls.
This lets you make API calls for all the data. This function may throw an NSException. The returned object is NOT thread safe.
Declared In
EvernoteSession.hupdateCurrentBootstrapProfileWithName:
Change the bootstrap profile.
- (void)updateCurrentBootstrapProfileWithName:(NSString *)aProfileNameParameters
- aProfileName
The name of the profile to be switched to.
Discussion
Change the bootstrap profile.
This is only used by the Authentication flow and should not be called the the application.
Declared In
EvernoteSession.huserStore
Create a new UserStore client for EDAM calls.
- (EDAMUserStoreClient *)userStoreReturn Value
Returns the user store client.
Discussion
Create a new UserStore client for EDAM calls.
This lets you make API calls to get information about the user. This function may throw an NSException. The returned object is NOT thread safe.
Declared In
EvernoteSession.h