1 / 37

The Alfresco iOS SDK

The Alfresco iOS SDK. Gi Lee (Zia Consulting) Peter Schmidt (Alfresco). Alfresco iOS SDK – Intro Who we are. Gi Lee Zia Consulting (Technical Architect) gi.lee@ziaconsulting.com Objective-C CMIS library. Peter Schmidt Alfresco Software (Senior iOS Engineer)

kennan
Télécharger la présentation

The Alfresco iOS SDK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Alfresco iOS SDK • Gi Lee (Zia Consulting) • Peter Schmidt (Alfresco)

  2. Alfresco iOS SDK – Intro Who we are • Gi Lee Zia Consulting (Technical Architect) gi.lee@ziaconsulting.com Objective-C CMIS library • Peter Schmidt • Alfresco Software • (Senior iOS Engineer) • peter.schmidt@alfresco.com • Alfresco SDK library & samples apps

  3. Alfresco iOS SDK – IntroWhat we will talk about • Gi Lee CMIS library (Apache) • Part of iOS Alfresco SDK • Architecture & Design • Code examples • Peter Schmidt • Alfresco SDK • How to get and install it • Architecture & Design • Code examples • Demo of Sample app • How to get support

  4. ObjectiveCMIS – The BasicsIntroducing the library • Low level API for CMIS • Static Cocoa Touch Library • No third-party API’s • Asynchronous • AtomPub binding support

  5. ObjectiveCMIS – The BasicsThe Xcode project CMIS API Library Cocoa Touch Static Library Min. Req. iOS 5.1 XCode 4.x • ARC • Blocks Documentation AppleDoc DocSet

  6. ObjectiveCMIS – The BasicsAn open source project • Open source Objective-C implementation of CMIS • Apache 2.0 license • Collaborative project • Recently accepted by Apache Chemistry

  7. ObjectiveCMIS – The BasicsiOS specifics • Naming Convention • ObjectiveCMIS code prefixed with CMIS • Error Handling • No exceptions in iOS, use NSError • As per Apple standard:“NSError object remains nil if method call is successful.”Always check! • Automated Reference Counting • No more retain, release, autorelease on object • Blocks • Used to handle asynchronous requests & callbacks

  8. ObjectiveCMIS – The BasicsWhat are blocks? • Closures for Objective-C, C, C++ • Introduced in iOS 4 • Ad hoc functionality that can be passed like parameters • Good for callbacks!

  9. ObjectiveCMIS – The BasicsAsynchronous handling CMIS API // Completion Block If(nil != session) { self.session = session; … } else { /* error handling */ } Repository

  10. ObjectiveCMIS – Design & ArchitectureThe API layers • Client Object API • Object Oriented • Easy to Use • Built-In LinkCache • Client Binding API • Low-Level API • Follows the CMIS Domain Model • More Control • Clunky to Implement

  11. ObjectiveCMIS – Design & ArchitectureClient API common interface

  12. ObjectiveCMIS - Getting StartedHow do I use it? • Added as a binary + Headers • Simple • Need to generate binary • Added to a Xcode Workspace • Extends workflow scope • Provides full access to source code

  13. ObjectiveCMIS – Getting Started… as a Generated Binary + Headers • Execute the script build_universal_lib.sh • Add generated build output folder to your project • Configure the build target dependency • Link  libObjectiveCMIS.a • Configure the Target Build Settings • User Header Search Paths = “$(BUILT_PRODUCTS_DIR)”[recursive] • Other Linker Flags = “-ObjC –all_load”

  14. ObjectiveCMIS – Getting Started… added to an Xcode workspace • Open/Create Xcode Workspace • Add the ObjectiveCMIS project to the workspace • Configure the build target dependency • Link  libObjectiveCMIS.a • Configure the target Build Settings • User Header Search Paths = “$(BUILT_PRODUCTS_DIR)”[recursive] • Other Linker Flags = “-ObjC –all_load” • Configure the project build scheme (optional)

  15. ObjectiveCMIS – Getting StartedIn a nutshell • Add ObjectiveCMIS to your project • Link the library libObjectiveCMIS.a • Configure the target Build Settings • User Header Search Paths = “$(BUILT_PRODUCTS_DIR)”[recursive] • Other Linker Flags = “-ObjC –all_load”

  16. ObjectiveCMIS – Documentation http://gentlebytes.com/appledoc

  17. ObjectiveCMIS – DocumentationGenerating the documentation • Setup AppleDoc • Clone the source from Github • https://github.com/tomaz/appledoc • Install Appledoc using the script install-appledoc.sh install-appledoc.sh –b /usr/bin/ -t ~/Library/Application\ Support/appledoc • Generate Documentation • Open the ObjectiveCMIS Xcode project • Run the target “Documentation”

  18. ObjectiveCMIS – Code ExampleSetup a CMIS session // Define session parameters CMISSessionParameters *params = [[CMISSessionParametersalloc] initWithBindingType:CMISBindingTypeAtomPub]; params.atomPubUrl = [NSURLURLWithString:cmisAtompubLocation]; params.username = @”devconUser"; params.password = @”devconPassword"; params.repositoryId = self.repoId; // Connect session [CMISSessionconnectWithSessionParameters:sessionParams completionBlock:^(CMISSession *session, NSError *error) { if (session == nil) { // Error handling code goes here // Dig into error object to determine cause } else { // CMISSession successfully connected self.session = session; } }];

  19. ObjectiveCMIS – Code ExampleGet the root collection [self.sessionretrieveRootFolderWithCompletionBlock: ^(CMISFolder *folder, NSError *error) { if (nil == folder) { // Error handling code goes here // Dig into error object to determine cause } else { /* Folder object is the root */ self.rootFolder = folder; } }];

  20. Objective CMIS – Code ExampleQuery // Create Query Completion Block void(^queryCompBlock)(CMISPagedResult *pagedResult, NSError *error); queryCompBlock = ^(CMISPagedResult *pagedResult, NSError *error) { if (nil == pagedResult) { // Error handling code goes here // Dig into error object to determine cause } else { /* Process the Paged Results */ } }; NSString *queryStr = @"SELECT * FROM cmis:document WHERE CONTAINS('DevCon')"; // Execute Query [self.sessionquery:queryStr searchAllVersions:NO completionBlock:queryCompBlock];

  21. ObjectiveCMISHow do I get the library? Alfresco / Objective-CMIS https://github.com/alfresco/Objective-CMIS COMING SOON!

  22. Alfresco iOS SDK – The BasicsWhat is included? Sample Apps Mobile API Library Including Objective CMIS library Min. Req. iOS 5.1 XCode 4.x Documentation (appledoc docset) • ARC • JSON • Storyboards

  23. Alfresco iOS SDK – The BasicsHow do I get the SDK? • Download it from our website • https://developer.alfresco.com/mobile • From our public github repository • https://github.com/Alfresco/alfresco-ios-sdk • Online documentation/tutorial • https://developer.alfresco.com/resources/alfresco/pdf/iOS-SDK-1.0.pdf

  24. Alfresco iOS SDK – The BasicsHow do I install it? • Unzip alfresco-ios-sdk.zip file • Open XCode • File menu • Add files to… DONE ✔

  25. Alfresco iOS SDK - Architecture & Design Design Principles • Session-Service-Model • Session for connections • Services for requests between app & server • Model to handle data • Blocks • To handle asynchronous behaviour Asynchronous calls Repository Alfresco in the Cloud

  26. Alfresco iOS SDK - Architecture & DesignOverall Structure

  27. Alfresco iOS SDK - Architecture & Design Session

  28. Alfresco iOS SDK - Architecture & Design Services

  29. Alfresco iOS SDK – CodingCreate a Session #import“AlfrescoRepositorySession.h” … @property (nonatomic, strong) id<AlfrescoSession> session; … [AlfrescoRepositorySession connectWithUrl:url username:username password:password parameters:nil completionBlock:^(id<AlfrescoSession>session, NSError *error){ if(nil == session)  FAILURE error handling else weakSelf.session = session; }];

  30. Alfresco iOS SDK – CodingBlocks Everywhere • Used in most methods of Alfresco SDK • Used to encapsulate asynchronous REST API/CMIS calls • EXAMPLE • Get the children in the root folder • #import“AlfrescoDocumentFolderService.h” • … • AlfrescoDocumentFolderService *folderService = • [[AlfrescoDocumentFolderService alloc] initWithSession:self.session]; • [folderService retrieveChildrenInFolder:self.session.rootFolder • completionBlock:^(NSArray *children, NSError *error){ • if(nil != children) • { • …<put your code handling folder children here> • } • }];

  31. Alfresco iOS SDK – CodingWhat about connecting to Cloud? • Alfresco Cloud uses OAuth 2 for authenticating • Register with Cloud to get an API key and Secret key • Provide both in your APP • Alfresco iOS SDK provides a set of helper classes • AlfrescoOAuthLoginViewController • Connects to login page • Handles the OAuth dance • Returns access/refresh token as part of AlfrescoOAuthData

  32. Alfresco iOS SDK – CodingCloud OAuth Dance

  33. Alfresco iOS SDK – CodingConnecting to Alfresco in the Cloud #import“AlfrescoCloudSession.h” #import“AlfrescoOAuthData.h” #import“AlfrescoOAuthDataLoginViewController.h” … AlfrescoOAuthCompletionBlock completionBlock = ^void(AlfrescoOAuthData*oauthData,NSError*error){ if(nil != oauthData) { [AlfrescoCloudSession connectWithOAuthData:oauthData parameters:nil completionBlock:(id<AlfrescoSession>session, NSError*error{ <your session handling goes here> }]; } }; AlfrescoOAuthLoginViewController *controller = [[AlfrescoOAuthLoginViewController alloc] initWithAPIKey:apiKey secretKey:secretKey completionBlock:completionBlock]; [self.navigationController pushViewController:controller animated:YES];

  34. Alfresco iOS SDK – CodingDemo time

  35. Alfresco iOS SDK – The RestWhat about support – CMIS library? • Apache mailing list • dev@chemistry.apache.org • Subscribe & archive: • http://mail-archives.apache.org/mod_mbox/chemistry-dev/ • Raise tickets in JIRA • https://issues.apache.org/jira/browse/CMIS • Component: objectivecmis • (you’d need an account for that) • Apache Chemistry website • http://chemistry.apache.org

  36. Alfresco iOS SDK – The RestWhat about support – Alfresco SDK? • Alfresco Forums • https://forums.alfresco.com • Look for Alfresco Mobile • Raise tickets in JIRA • https://issues.alfresco.com/jira/browse/MOBSDK • (you need a JIRA account for this) • Project: Mobile SDK • Components: API • Affects Version: iOS x.x • Assignee: Mobile Team unassigned • Have Support Agreement? • Contact Support

  37. Alfresco iOS SDK – The RestFeedback, Q&A? • Feedback • Regarding SDK • Regarding tutorials • Your Questions answered

More Related