connectWithUrl: - Connects and authenticates a session
represented by the URL. This method will use Basic HTTP authentication to authorize the user.
Once the session has been initialized the provided completionBlock is called
on the main thread.
connectWithUrl:username:password:completionBlock:
+ (void)connectWithUrl:(NSURL *)url username:(NSString *)username
password:(NSString *)password
completionBlock:(AlfrescoSessionCompletionBlock)completionBlock - Connects and
authenticates a session represented by the URL using the given user identifier and password.
This method will use Basic HTTP authentication to authorize the user. Once the session has
been initialized the provided completionBlock is called on the main
thread.
Parameters
- (NSURL *) url
- The server URL used to establish a session. Required.
- (NSString *) username
- The username of the account with which to connect to the repository. Required.
- (NSString *) password
- The password corresponding to the specified username. Required.
- (AlfrescoSessionCompletionBlock) completionBlock
- The completion block invoked when the operation completes. The completion block has the format typedef void (^AlfrescoSessionCompletionBlock)(id<AlfrescoSession> session, NSError *error).
Returns
(void)
Example
connectWithUrl:username:password:completionBlock:
+ (void)connectWithUrl:(NSURL *)url username:(NSString *)username
password:(NSString *)password parameters:(NSDictionary *)parameters
completionBlock:(AlfrescoSessionCompletionBlock)completionBlock - Connects and
authenticates a session represented by the URL using the given user identifier, password and
parameters. This method will use Basic HTTP authentication to authorize the user. Once the
session has been initialized the provided completionBlock is called on the
main thread.
Parameters
- (NSURL *) url
- The server URL used to establish a session. Required.
- (NSString *) username
- The username of the account with which to connect to the repository. Required.
- (NSString *) password
- The password corresponding to the specified username. Required.
- (NSDictionary *) parameters
- A dictionary containing parameters for the session. Optional (can be nil).
- (AlfrescoSessionCompletionBlock) completionBlock
- The completion block invoked when the operation completes. The completion block has the format typedef void (^AlfrescoSessionCompletionBlock)(id<AlfrescoSession> session, NSError *error).
Returns
(void)
Example
NSURL *url = [NSURL URLWithString:@"http://localhost:8080/alfresco"]; NSString *username = @"admin"; NSString *password = @"admin"; __weak HelloRepoViewController *weakSelf = self; [AlfrescoRepositorySession connectWithUrl:url username:username password:password parameters:nil completionBlock:^(id<AlfrescoSession> session, NSError *error) { if (nil == session) { NSLog(@"Failed to authenticate: %@:", error); } else { NSLog(@"Authenticated successfully"); NSLog(@"Repository version: %@", session.repositoryInfo.version); NSLog(@"Repository edition: %@", session.repositoryInfo.edition); weakSelf.session = session; [weakSelf loadRootFolder]; } }];