[Pkg-owncloud-commits] [owncloud-doc] 08/25: Added developer documentation for Android and iOS libraries to get access to OC servers
David Prévot
taffit at moszumanska.debian.org
Thu Oct 30 19:52:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud-doc.
commit 84e4493a776500ddafa7741a9b18d1c070b2b057
Author: David A. Velasco <dvelasco at solidgear.es>
Date: Thu Oct 23 18:00:09 2014 +0200
Added developer documentation for Android and iOS libraries to get access to OC servers
---
developer_manual/android_library/examples.rst | 430 +++++++++++
.../images/1000000000000270000003A317117674.png | Bin 0 -> 134313 bytes
developer_manual/android_library/index.rst | 24 +
.../android_library/library_installation.rst | 41 ++
developer_manual/ios_library/examples.rst | 819 +++++++++++++++++++++
.../images/100000000000030C000001E61DFDBF76.png | Bin 0 -> 163510 bytes
.../images/100000000000030C000001E637605044.png | Bin 0 -> 131973 bytes
.../images/100000000000030C000001E7A7A01884.png | Bin 0 -> 84924 bytes
.../images/100000000000030C000001E8AB4C3306.png | Bin 0 -> 100796 bytes
.../images/100000000000030C000001ECB85120C2.png | Bin 0 -> 95656 bytes
.../images/10000201000003430000020C65A3C5A7.png | Bin 0 -> 166432 bytes
.../images/100002010000034700000211B6BE4A2B.png | Bin 0 -> 134256 bytes
.../images/10000201000003480000020EC688993D.png | Bin 0 -> 144318 bytes
.../images/10000201000003B9000002B619E44B0C.png | Bin 0 -> 110291 bytes
.../images/10000201000003B9000002B66AC4279B.png | Bin 0 -> 132024 bytes
.../images/10000201000003B9000002B68F027979.png | Bin 0 -> 146243 bytes
.../images/10000201000003B9000002B69A5110D2.png | Bin 0 -> 131846 bytes
.../images/100002010000046D000002B55ECA38D5.png | Bin 0 -> 180856 bytes
developer_manual/ios_library/index.rst | 25 +
.../ios_library/library_installation.rst | 133 ++++
20 files changed, 1472 insertions(+)
diff --git a/developer_manual/android_library/examples.rst b/developer_manual/android_library/examples.rst
new file mode 100644
index 0000000..3be4a68
--- /dev/null
+++ b/developer_manual/android_library/examples.rst
@@ -0,0 +1,430 @@
+Examples
+========
+
+Init the library
+----------------
+
+Start using the library; it is needed to init the object mClient that will be
+in charge of keeping the communication with the server.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ public class MainActivity extends Activity
+ implements OnRemoteOperationListener,
+ OnDatatransferProgressListener {
+ private OwnCloudClient mClient;
+ private Handler mHandler = new Handler();
+
+ ...
+
+ public void onCreate(Bundle savedInstanceState) {
+
+ ...
+
+ // Parse URI to the base URL of the ownCloud server
+ Uri serverUri = Uri.parse(getString(R.string.server_base_url));
+
+ // Create client object to perform remote operations
+ mClient = OwnCloudClientFactory.createOwnCloudClient(
+ serverUri,
+ this,
+ // Activity or Service context
+ true);
+
+
+Set credentials
+---------------
+
+Authentication on the app is possible by 3 different methods:
+
+* Basic authentication, user name and password
+* Bearer access token (oAuth2)
+* Cookie (SAML-based single-sign-on)
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ package com.owncloud.android.lib.common;
+
+ public class OwnCloudClient extends HttpClient {
+ ...
+ // Set basic credentials
+ client.setCredentials(
+ OwnCloudCredentialsFactory.newBasicCredentials(username, password)
+ );
+ // Set bearer access token
+ client.setCredentials(
+ OwnCloudCredentialsFactory.newBearerCredentials(accessToken)
+ );
+ // Set SAML2 session token
+ client.setCredentials(
+ OwnCloudCredentialsFactory.newSamlSsoCredentials(cookie)
+ );
+ }
+
+Create a folder
+---------------
+
+Create a new folder on the cloud server, the info needed to be sent is the path
+of the new folder.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startFolderCreation(String newFolderPath) {
+ CreateRemoteFolderOperation createOperation = new CreateRemoteFolderOperation(newFolderPath, false);
+ createOperation.execute( mClient , this , mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof CreateRemoteFolderOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ …
+ }
+
+Read folder
+-----------
+
+Get the content of an existing folder on the cloud server, the info needed to
+be sent is the path of the folder, in the example shown it has been asked the
+content of the root folder. As answer of this method, it will be received an
+array with all the files and folders stored in the selected folder.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startReadRootFolder() {
+ ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(FileUtils.PATH_SEPARATOR);
+ // root folder
+ refreshOperation.execute(mClient, this, mHandler);
+ }
+
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof ReadRemoteFolderOperation) {
+ if (result.isSuccess()) {
+ List< RemoteFile > files = result.getData();
+ // do your stuff here
+ }
+ }
+ …
+ }
+
+Read file
+---------
+
+Get information related to a certain file or folder, information obtained is:
+``filePath``, ``filename``, ``isDirectory``, ``size`` and ``date``.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startReadFileProperties(String filePath) {
+ ReadRemoteFileOperation readOperation = new ReadRemoteFileOperation(filePath);
+ readOperation.execute(mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof ReadRemoteFileOperation) {
+ if (result.isSuccess()) {
+ RemoteFile file = result.getData()[0];
+ // do your stuff here
+ }
+ }
+ …
+ }
+
+Delete file or folder
+---------------------
+
+Delete a file or folder on the cloud server. The info needed is the path of
+folder/file to be deleted.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startRemoveFile(String filePath) {
+ RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath);
+ removeOperation.execute( mClient , this , mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof RemoveRemoteFileOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ …
+ }
+
+
+Download a file
+---------------
+
+Download an existing file on the cloud server. The info needed is path of the
+file on the server and targetDirectory, path where the file will be stored on
+the device.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startDownload(String filePath, File targetDirectory) {
+ DownloadRemoteFileOperation downloadOperation = new DownloadRemoteFileOperation(filePath, targetDirectory.getAbsolutePath());
+ downloadOperation.addDatatransferProgressListener(this);
+ downloadOperation.execute( mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish( RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof DownloadRemoteFileOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ }
+
+ @Override
+ public void onTransferProgress( long progressRate, long totalTransferredSoFar, long totalToTransfer, String fileName) {
+ mHandler.post( new Runnable() {
+ @Override
+ public void run() {
+ // do your UI updates about progress here
+ }
+ });
+ }
+
+Upload a file
+-------------
+
+Upload a new file to the cloud server. The info needed is fileToUpload, path
+where the file is stored on the device, remotePath, path where the file will be
+stored on the server and mimeType.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startUpload (File fileToUpload, String remotePath, String mimeType) {
+ UploadRemoteFileOperation uploadOperation = new UploadRemoteFileOperation( fileToUpload.getAbsolutePath(), remotePath, mimeType);
+ uploadOperation.addDatatransferProgressListener(this);
+ uploadOperation.execute(mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof UploadRemoteFileOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ }
+
+ @Override
+ public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String fileName) {
+ mHandler.post( new Runnable() {
+ @Override
+ public void run() {
+ // do your UI updates about progress here
+ }
+ });
+ }
+
+Move a file or folder
+---------------------
+
+Move an exisintg file or folder to a different location in the ownCloud server. Parameters needed are the path
+to the file or folder to move, and the new path desired for it. The parent folder of the new path must exist in
+the server.
+
+When the parameter 'overwrite' is set to 'true', the file or folder is moved even if the new path is already
+used by a different file or folder. This one will be replaced by the former.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startFileMove(String filePath, String newFilePath, boolean overwrite) {
+ MoveRemoteFileOperation moveOperation = new MoveRemoteFileOperation(filePath, newFilePath, overwrite);
+ moveOperation.execute( mClient , this , mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof MoveRemoteFileOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ …
+ }
+
+Read shared items by link
+-------------------------
+
+Get information about what files and folder are shared by link (the object
+mClient contains the information about the server url and account)
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startAllSharesRetrieval() {
+ GetRemoteSharesOperation getSharesOp = new GetRemoteSharesOperation();
+ getSharesOp.execute( mClient , this , mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish( RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof GetRemoteSharesOperation) {
+ if (result.isSuccess()) {
+ ArrayList< OCShare > shares = new ArrayList< OCShare >();
+ for (Object obj: result.getData()) {
+ shares.add(( OCShare) obj);
+ }
+ // do your stuff here
+ }
+ }
+ }
+
+Get the share resources for a given file or folder
+--------------------------------------------------
+
+
+Get information about what files and folder are shared by link on a certain
+folder. The info needed is filePath, path of the file/folder on the server, the
+Boolean variable, getReshares, come from the Sharing api, from the moment it is
+not in use within the ownCloud Android library.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startSharesRetrievalForFileOrFolder(String filePath, boolean getReshares) {
+ GeteRemoteSharesForFileOperation operation = new GetRemoteSharesForFileOperation(filePath, getReshares, false);
+ operation.execute( mClient, this, mHandler);
+ }
+
+ private void startSharesRetrievalForFilesInFolder(String folderPath, boolean getReshares) {
+ GetRemoteSharesForFileOperation operation = new GetRemoteSharesForFileOperation(folderPath, getReshares, true);
+ operation.execute( mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish( RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof GetRemoteSharesForFileOperation) {
+ if (result.isSuccess()) {
+ ArrayList< OCShare > shares = new ArrayList< OCShare >();
+ for (Object obj: result.getData()) {
+ shares.add(( OCShare) obj);
+ }
+ // do your stuff here
+ }
+ }
+ }
+
+
+Share link of file or folder
+-----------------------------
+
+
+Share a file or a folder from your cloud server by link.
+
+The info needed is filePath, the path of the item that you want to share and
+Password, this comes from the Sharing api, from the moment it is not in use
+within the ownCloud Android library.
+
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startCreationOfPublicShareForFile(String filePath, String password) {
+ CreateRemoteShareOperation operation = new CreateRemoteShareOperation(filePath, ShareType.PUBLIC_LINK, "", false, password, 1);
+ operation.execute( mClient , this , mHandler);
+ }
+
+ private void startCreationOfGroupShareForFile(String filePath, String groupId) {
+ CreateRemoteShareOperation operation = new CreateRemoteShareOperation(filePath, ShareType.GROUP, groupId, false , "", 31);
+ operation.execute(mClient, this, mHandler);
+ }
+
+ private void startCreationOfUserShareForFile(String filePath, String userId) {
+ CreateRemoteShareOperation operation = new CreateRemoteShareOperation(filePath, ShareType.USER, userId, false, "", 31);
+ operation.execute(mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish( RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof CreateRemoteShareOperation) {
+ if (result.isSuccess()) {
+ OCShare share = (OCShare) result.getData ().get(0);
+ // do your stuff here
+ }
+ }
+ }
+
+
+Delete a share resource
+-----------------------
+
+Stop sharing by link a file or a folder from your cloud server.
+
+The info needed is the object OCShare that you want to stop sharing by link.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: java
+
+ private void startShareRemoval(OCShare share) {
+ RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
+ operation.execute( mClient, this, mHandler);
+ }
+
+ @Override
+ public void onRemoteOperationFinish( RemoteOperation operation, RemoteOperationResult result) {
+ if (operation instanceof RemoveRemoteShareOperation) {
+ if (result.isSuccess()) {
+ // do your stuff here
+ }
+ }
+ }
+
+
+Tips
+----
+
+* Credentials must be set before calling any method
+* Paths must not be on URL Encoding
+* Correct path: ``http://www.myowncloudserver.com/owncloud/remote.php/webdav/PopMusic``
+* Wrong path: ``http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop%20Music/``
+* There are some forbidden characters to be used in folder and files names on the server, same on the ownCloud Android Library "\","/","<",">",":",""","|","?","*"
+* Upload and download actions may be cancelled thanks to the objects uploadOperation.cancel(), downloadOperation.cancel()
+* Unit tests, before launching unit tests you have to enter your account information (server url, user and password) on TestActivity.java
diff --git a/developer_manual/android_library/images/1000000000000270000003A317117674.png b/developer_manual/android_library/images/1000000000000270000003A317117674.png
new file mode 100644
index 0000000..b992641
Binary files /dev/null and b/developer_manual/android_library/images/1000000000000270000003A317117674.png differ
diff --git a/developer_manual/android_library/index.rst b/developer_manual/android_library/index.rst
new file mode 100644
index 0000000..8c9a40e
--- /dev/null
+++ b/developer_manual/android_library/index.rst
@@ -0,0 +1,24 @@
+.. _androidindex:
+
+===============================
+Android Application Development
+===============================
+
+This document will describe how to the use ownCloud Android Library. The
+ownCloud Android Library allows a developer to communicate with any ownCloud
+server; among the features included are file synchronization, upload and
+download of files, delete rename files and folders, etc.
+
+This library may be added to a project and seamlessly integrates any
+application with ownCloud.
+
+The tool needed is any IDE for Android. This guide includes some screenshots
+showing examples in Eclipse.
+
+.. toctree::
+ :maxdepth: 1
+ :hidden:
+
+ library_installation
+ examples
+
diff --git a/developer_manual/android_library/library_installation.rst b/developer_manual/android_library/library_installation.rst
new file mode 100644
index 0000000..d22c2ef
--- /dev/null
+++ b/developer_manual/android_library/library_installation.rst
@@ -0,0 +1,41 @@
+Library Installation
+====================
+
+Obtaining the library
+---------------------
+
+
+The ownCloud Android library may be obtained from the following Github repository:
+
+`https://github.com/owncloud/android-library <https://github.com/owncloud/android-library>`_
+
+Once obtained, this code should be compiled. The Github repository not only contains the library, but also a sample project, sample_client
+sample_client properties/android/librerias
+, which will assist in learning how to use the library.
+
+
+Add the library to a project
+----------------------------
+
+There are different methods to add an external library to a project, then we will describe one of them.
+
+#. Compile the ownCloud Android Library
+
+
+
+#. Define a dependency within your project.
+
+
+
+For that, access to
+Properties > Android > Library
+** **
+and click on add and select the ownCloud Android library
+
+|1000000000000270000003A317117674_png|
+
+Then all the public classes and methods of the library will be available for your own app.
+
+.. |1000000000000270000003A317117674_png| image:: images/1000000000000270000003A317117674.png
+ :width: 10.795cm
+ :height: 16.106cm
diff --git a/developer_manual/ios_library/examples.rst b/developer_manual/ios_library/examples.rst
new file mode 100644
index 0000000..26f921c
--- /dev/null
+++ b/developer_manual/ios_library/examples.rst
@@ -0,0 +1,819 @@
+Examples
+========
+
+Init the library
+----------------
+
+Start using the library, it is needed to init the object OCCommunication.
+
+We recommend using the singleton method in the AppDelegate class in order to
+use the ownCloud iOS library.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ #import "OCCommunication.h"
+
+ + (OCCommunication *)sharedOCCommunication
+ {
+ static OCCommunication* sharedOCCommunication = nil;
+
+ if (sharedOCCommunication == nil)
+ {
+ sharedOCCommunication = [ [ OCCommunicationalloc] init ];
+ }
+
+ return sharedOCCommunication;
+ }
+
+Also could happen that you need to overwrite the class AFURLSessionManager to manage SSL Certificates
+
+.. code-block:: objective-c
+
+ #import "OCCommunication.h"
+
+ + (OCCommunication*)sharedOCCommunication
+ {
+ static OCCommunication* sharedOCCommunication = nil;
+ if (sharedOCCommunication == nil)
+ {
+ //Network Upload queue for NSURLSession (iOS 7)
+ NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:k_session_name];
+ configuration.HTTPMaximumConnectionsPerHost = 1;
+ configuration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
+ OCURLSessionManager *uploadSessionManager = [[OCURLSessionManager alloc] initWithSessionConfiguration:configuration];
+ [uploadSessionManager.operationQueue setMaxConcurrentOperationCount:1];
+ [uploadSessionManager setSessionDidReceiveAuthenticationChallengeBlock:^NSURLSessionAuthChallengeDisposition (NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential) {
+ return NSURLSessionAuthChallengePerformDefaultHandling;
+ }];
+
+ sharedOCCommunication = [[OCCommunication alloc] initWithUploadSessionManager:uploadSessionManager];
+
+ }
+ return sharedOCCommunication;
+ }
+
+Set credentials
+---------------
+
+Authentication on the app is possible by 3 different methods:
+
+* Basic authentication, user name and password
+* Cookie
+* Token (oAuth)
+
+
+Code example
+~~~~~~~~~~~~
+
+
+.. code-block:: objective-c
+
+ #Basic authentication, user name and password
+ [[ AppDelegate sharedOCCommunication ] setCredentialsWithUser : userName andPassword : password ];
+
+ #Authentication with cookie
+ [[ AppDelegate sharedOCCommunication ] setCredentialsWithCookie : cookie ];
+
+ #Authentication with token
+ [[ AppDelegate sharedOCCommunication ] setCredentialsOauthWithToken : token ];
+
+
+Create a folder
+---------------
+
+Create a new folder on the cloud server, the info needed to be sent is the path
+of the new folder.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] createFolder :path onCommunication : [ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //Folder Created
+ }
+
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error) {
+
+ //Failure
+
+ switch (response.statusCode) {
+
+ case kOCErrorServerUnauthorized :
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden :
+ //Forbidden
+ break;
+ case kOCErrorServerPathNotFound :
+ //Not Found
+ break;
+ case kOCErrorServerTimeout :
+ //timeout
+ break;
+ default:
+ //default
+ break;
+ }
+
+ }
+ errorBeforeRequest :^( NSError *error) {
+ //Error before request
+
+ if (error.code == OCErrorForbidenCharacters) {
+ //Forbidden characters
+ }
+ else
+ {
+ //Other error
+ }
+
+ }];
+
+Read folder
+-----------
+
+Get the content of an existing folder on the cloud server, the info needed to
+be sent is the path of the folder. As answer of this method, it will be
+received an array with all the files and folders stored in the selected folder.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication] readFolder:path onCommunication:[ AppDelegate sharedOCCommunication]
+
+ successRequest:^( NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+ //Success
+ for ( OCFileDto * ocFileDto in items) {
+ NSLog( @"item path: %@%@" , ocFileDto.filePath, ocFileDto.fileName);
+ }
+ }
+
+ failureRequest:^( NSHTTPURLResponse *response, NSError *error) {
+
+ //Failure
+ switch (response.statusCode) {
+ case kOCErrorServerPathNotFound :
+ //Path not found
+ break;
+ case kOCErrorServerUnauthorized :
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden :
+ //Forbidden
+ break;
+ case kOCErrorServerTimeout :
+ //Timeout
+ break ;
+ default :
+ break;
+ }
+
+ }];
+
+Read file
+---------
+
+Get information related to a certain file or folder. Although, more information
+can be obtained, the library only gets the eTag.
+
+Other properties of the file or folder may be obtained: filePath, filename,
+isDirectory, size and date
+
+Code example
+~~~~~~~~~~~~
+
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] readFile :path onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+
+ OCFileDto *ocFileDto = [items objectAtIndex : 0 ];
+ NSLog ( @"item etag: %lld" , ocFileDto. etag); }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error) {
+ switch (response.statusCode) {
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ case kOCErrorServerUnauthorized:
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorServerTimeout:
+ //Timeout
+ break;
+ default:
+ break;
+ }
+ }];
+
+Move file or folder
+-------------------
+
+
+Move a file or folder from their current path to a new one on the cloud server.
+The info needed is the origin path and the destiny path.
+
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] moveFileOrFolder :sourcePath toDestiny :destinyPath onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //File/Folder moved or renamed
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error) {
+ //Failure
+ switch (response.statusCode) {
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ case kOCErrorServerUnauthorized:
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorServerTimeout:
+ //Timeout
+ break;
+ default:
+ break;
+ }
+
+ }
+ errorBeforeRequest :^( NSError *error) {
+ if (error.code == OCErrorMovingTheDestinyAndOriginAreTheSame) {
+ //The destiny and the origin are the same
+ }
+ else if (error.code == OCErrorMovingFolderInsideHimself) {
+ //Moving folder inside himself
+ }
+ else if (error.code == OCErrorMovingDestinyNameHaveForbiddenCharacters) {
+ //Forbidden Characters
+ }
+ else
+ {
+ //Default
+ }
+
+ }];
+
+
+Delete file or folder
+---------------------
+
+Delete a file or folder on the cloud server. The info needed is the path to
+delete.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] deleteFileOrFolder :path onCommunication :[ AppDelegate
+
+ sharedOCCommunication ] successRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //File or Folder deleted
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error) {
+
+ switch (response.statusCode) {
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ case kOCErrorServerUnauthorized:
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorServerTimeout:
+ //Timeout
+ break;
+ default:
+ break;
+ }
+
+ }];
+
+
+Download a file
+---------------
+
+Download an existing file on the cloud server. The info needed is the server
+URL, path of the file on the server and localPath, path where the file will be
+stored on the device and a boolean to indicate if is neccesary to use LIFO queue or FIFO.
+
+Code example
+~~~~~~~~~~~~
+
+
+.. code-block:: objective-c
+
+ NSOperation *op = nil;
+ op = [[ AppDelegate sharedOCCommunication ] downloadFile :remotePath toDestiny :localPath withLIFOSystem:isLIFO onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ progressDownload :^( NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) {
+
+ //Calculate percent
+ float percent = ( float)totalBytesRead / totalBytesExpectedToRead;
+ NSLog ( @"Percent of download: %f" , percent); }
+ successRequest :^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //Download complete
+ }
+ failureRequest :^(NSHTTPURLResponse *response, NSError *error) {
+ switch (response. statusCode) {
+ case kOCErrorServerUnauthorized:
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorProxyAuth:
+ //Proxy access required
+ break;
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ default:
+ //Default
+ break;
+ }
+ }
+ shouldExecuteAsBackgroundTaskWithExpirationHandler :^{
+ [op cancel ];
+ }];
+
+
+
+
+
+Download a file with background session
+-------------------------------------
+
+Download an existing file storaged on the cloud server using background session, only supported by iOS 7 and higher.
+
+The info needed is, the server URL: path where the file is stored on the server; localPath: path where the file will be stored on the device; and NSProgress: object where get the callbacks of the upload progress.
+
+To get the callbacks of the progress is needed use a KVO in the progress object. We add the code in this example of the call to set the KVO and the method where catch the notifications.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ NSURLSessionDownloadTask *downloadTask = nil;
+
+ NSProgress *progress = nil;
+
+ downloadTask = [_sharedOCCommunication downloadFileSession:serverUrl toDestiny:localPath defaultPriority:YES onCommunication:_sharedOCCommunication withProgress:&progress successRequest:^(NSURLResponse *response, NSURL *filePath) {
+ //Upload complete
+ } failureRequest:^(NSURLResponse *response, NSError *error) {
+
+ switch (error.code) {
+ case kCFURLErrorUserCancelledAuthentication:
+ //Authentication cancelled
+ break;
+
+ default:
+ switch (response.statusCode) {
+ case kOCErrorServerUnauthorized :
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorProxyAuth:
+ //Proxy access required
+ break;
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ default:
+ //Default
+ break;
+ }
+ break;
+ }
+ }];
+
+ // Observe fractionCompleted using KVO
+ [progress addObserver:self forKeyPath:@"fractionCompleted" options:NSKeyValueObservingOptionNew context:NULL];
+
+
+ //Method to catch the progress notifications with callbacks
+ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+ {
+ if ([keyPath isEqualToString:@"fractionCompleted"] && [object isKindOfClass:[NSProgress class]]) {
+ NSProgress *progress = (NSProgress *)object;
+
+ float percent = roundf (progress.fractionCompleted * 100);
+
+ //We make it on the main thread because we came from a delegate
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSLog(@"Progress is %f", percent);
+ });
+ }
+ }
+
+
+Set callback when background download task finishes
+-----------------------------------------
+
+Method to set callbacks of the pending download transfers when the app starts. It's used when there are pendings download background transfers. The block is executed when a pending background task finishes.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] setDownloadTaskComleteBlock:^NSURL *(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location) {
+
+
+ }];
+
+Set progress callback with pending background download tasks
+---------------------------------------------------
+
+Method to set progress callbacks of the pending download transfers. It's used when there are pendings background download transfers. The block is executed when a pending task get a input porgress.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] setDownloadTaskDidGetBodyDataBlock:^(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
+
+
+ }];
+
+
+
+
+
+Upload a file
+-------------
+
+Upload a new file to the cloud server. The info needed is localPath, path where
+the file is stored on the device and server URL, path where the file will be
+stored on the server.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ NSOperation *op = nil;
+ op = [[ AppDelegate sharedOCCommunication ] uploadFile :localPath toDestiny : remotePath onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ progressUpload :^( NSUInteger bytesWrote, long long totalBytesWrote, long long totalBytesExpectedToWrite) {
+ //Calculate upload percent
+ if ( totalBytesExpectedToRead/1024 != 0) {
+ if ( bytesWrote > 0) {
+ float percent = totalBytesWrote* 100 / totalBytesExpectedToRead;
+ NSLog ( @"Percent: %f" , percent);
+ }
+ }
+ }
+ successRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //Upload complete
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer, NSError *error) {
+ switch (response. statusCode) {
+ case kOCErrorServerUnauthorized :
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorProxyAuth:
+ //Proxy access required
+ break;
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ default:
+ //Default
+ break;
+ }
+ }
+ failureBeforeRequest :^( NSError *error) {
+ switch (error.code) {
+ case OCErrorFileToUploadDoesNotExist:
+ //File does not exist
+ break;
+ default:
+ //Default
+ break;
+ }
+ }
+ shouldExecuteAsBackgroundTaskWithExpirationHandler :^{
+ [op cancel];
+ }];
+
+
+Upload a file with background session
+-------------------------------------
+
+Upload a new file to the cloud server using background session, only supported by iOS 7 and higher.
+
+The info needed is localPath, path where the file is stored on the device and server URL, path where the file will be stored on the server and NSProgress object where get the callbacks of the upload progress.
+
+To get the callbacks of the progress is needed use a KVO in the progress object. We add the code in this example of the call to set the KVO and the method where catch the notifications.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ NSURLSessionUploadTask *uploadTask = nil;
+
+ NSProgress *progress = nil;
+
+ uploadTask = [[AppDelegate sharedOCCommunication] uploadFileSession:localPath toDestiny:remotePath onCommunication:[ AppDelegate sharedOCCommunication ] withProgress:&progress successRequest:^(NSURLResponse *response, NSString *redirectedServer) {
+ //Upload complete
+ } failureRequest:^(NSURLResponse *response, NSString *redirectedServer, NSError *error) {
+ switch (response.statusCode) {
+ case kOCErrorServerUnauthorized :
+ //Bad credentials
+ break;
+ case kOCErrorServerForbidden:
+ //Forbidden
+ break;
+ case kOCErrorProxyAuth:
+ //Proxy access required
+ break;
+ case kOCErrorServerPathNotFound:
+ //Path not found
+ break;
+ default:
+ //Default
+ break;
+ }
+
+ }];
+
+ // Observe fractionCompleted using KVO
+ [progress addObserver:self forKeyPath:@"fractionCompleted" options:NSKeyValueObservingOptionNew context:NULL];
+
+
+
+ //Method to catch the progress notifications with callbacks
+ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+ {
+ if ([keyPath isEqualToString:@"fractionCompleted"] && [object isKindOfClass:[NSProgress class]]) {
+ NSProgress *progress = (NSProgress *)object;
+
+ float percent = roundf (progress.fractionCompleted * 100);
+
+ //We make it on the main thread because we came from a delegate
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSLog(@"Progress is %f", percent);
+ });
+
+ }
+ }
+
+Set callback when background task finish
+-----------------------------------------
+
+Method to set callbacks of the pending transfers when the app starts. It's used when there are pendings background transfers. The block is executed when a pending background task finished.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] setTaskDidCompleteBlock:^(NSURLSession *session, NSURLSessionTask *task, NSError *error) {
+
+
+ }];
+
+Set progress callback with pending background tasks
+---------------------------------------------------
+
+Method to set progress callbacks of the pending transfers. It's used when there are pendings background transfers. The block is executed when a pending task get a input porgress.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] setTaskDidSendBodyDataBlock:^(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
+
+
+
+ }];
+
+
+Check if the server supports Sharing api
+----------------------------------------
+
+
+The Sharing API is included in ownCloud 5.0.13 and greater versions. The info
+needed is activeUser.url, the server URL that you want to check.
+
+Code Example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] hasServerShareSupport :_activeUser.url onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, BOOL hasSupport, NSString *redirectedServer) {
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error){
+ }
+ }];
+
+
+Read shared all items by link
+-----------------------------
+
+Get information about what files and folder are shared by link.
+
+The info needed is Path, the server URL that you want to check.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] readSharedByServer :path onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+ NSLog ( @"Item: %d" , items);
+ }
+
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error){
+ NSLog ( @"error: %@" , error);
+ NSLog ( @"Operation error: %d" , response.statusCode);
+ }];
+
+
+Read shared items by link of a path
+------------------------------------
+
+Get information about what files and folder are shared by link in a specific path.
+
+The info needed is the server URL that you want to check and the specific path tha you want to check.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] readSharedByServer:serverPath andPath:path onCommunication:[AppDelegate sharedOCCommunication] successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+ NSLog ( @"Item: %d" , items);
+
+
+ } failureRequest:^(NSHTTPURLResponse *response, NSError *error) {
+ NSLog ( @"error: %@" , error);
+ NSLog ( @"Operation error: %d" , response.statusCode);
+ }];
+
+Share link of file or folder
+----------------------------
+
+
+Share a file or a folder from your cloud server by link.
+The info needed is Path, your server URL and the path of the item that you want
+to share (for example ``/folder/file.pdf``)
+
+
+Code example
+~~~~~~~~~~~~
+
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] shareFileOrFolderByServer :path andFileOrFolderPath :itemPath onCommunication :[ AppDelegate sharedOCCommunication ]
+ successRequest :^( NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
+
+ NSString *sharedLink = [ NSString stringWithFormat:@ `path/public.php?service=files&t=%@ <mailto:path/public.php?service=files&t=%25@>`_
+ , token];
+
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error){
+ [ _delegate endLoading ];
+
+ DLog ( @”error.code: %d” , error. code);
+ DLog (@”server.error: %d”, response. statusCode);
+ int code = response. statusCode ;
+ if (error.code == kOCErrorServerPathNotFound) {
+ }
+
+ switch (code) {
+ case kOCErrorServerPathNotFound:
+ //File to share not exists
+ break;
+ case kOCErrorServerUnauthorized:
+ //Error login
+ break;
+ case kOCErrorServerForbidden:
+ //Permission error
+ break;
+ case kOCErrorServerTimeout:
+ //Not possible to connect to server
+ break;
+ default:
+ if (error.code == kOCErrorServerPathNotFound) {
+ //File to share not exists
+ } else {
+ //Not possible to connect to the server
+ }
+ break;
+
+ }
+
+ }];
+
+ }
+
+ NSLog ( @"error: %@" , error);
+ NSLog ( @"Operation error: %d" , response.statusCode);
+ }];
+
+Unshare a folder or file by link
+--------------------------------
+
+
+Stop sharing by link a file or a folder from your cloud server.
+
+The info needed is Path, your server URL and the Id of the item that you want
+to Unshare.
+
+Before unsharing an item, you have to read the shared items on the selected
+server, using the method “ readSharedByServer ” so that you get the array
+“items” with all the shared elements. These are objects OCShareDto, one of
+their properties is idRemoteShared, parameter needed to unshared an element.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[ AppDelegate sharedOCCommunication ] unShareFileOrFolderByServer :path andIdRemoteSharedShared :sharedByLink. idRemoteShared onCommunication :[ AppDelegate sharedOCCommunication ]
+
+ successRequest :^( NSHTTPURLResponse *response, NSString *redirectedServer) {
+ //File unshared
+ }
+ failureRequest :^( NSHTTPURLResponse *response, NSError *error){
+ //Error
+ }
+ ];
+
+
+Check if file of folder is shared
+----------------------------------
+
+Check if a specific file or folder is shared in your cloud server.
+
+Teh info need is Path, your server URL and the Id of the item that you want.
+
+
+Before check an item, you have to read the shared items on the selected
+server, using the method “ readSharedByServer ” so that you get the array
+“items” with all the shared elements. These are objects OCShareDto, one of
+their properties is idRemoteShared, parameter needed to unshared an element.
+
+Code example
+~~~~~~~~~~~~
+
+.. code-block:: objective-c
+
+ [[AppDelegate sharedOCCommunication] isShareFileOrFolderByServer:path andIdRemoteShared:_shareDto.idRemoteShared onCommunication:[AppDelegate sharedOCCommunication] successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, BOOL isShared) {
+ //File/Folder is shared
+
+ } failureRequest:^(NSHTTPURLResponse *response, NSError *error) {
+ //File/Folder is not shared
+ }];
+
+
+Tips
+----
+
+* Credentials must be set before calling any method
+* Paths must not be on URL Encoding
+* Correct path: ``http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop_Music/``
+* Wrong path: ``http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop%20Music/``
+* There are some forbidden characters to be used in folder and files names on the server, same on the ownCloud iOS library "\", "/","<",">",":",""","","?","*"
+* To move a folder the origin path and the destination path must end with “/”
+* To move a file the origin path and the destination path must not end with “/”
+* Upload and download actions may be cancelled thanks to the object “NSOperation”
+* Unit tests, before launching unit tests you have to enter your account information (server url, user and password) on OCCommunicationLibTests.m
diff --git a/developer_manual/ios_library/images/100000000000030C000001E61DFDBF76.png b/developer_manual/ios_library/images/100000000000030C000001E61DFDBF76.png
new file mode 100644
index 0000000..5c12b34
Binary files /dev/null and b/developer_manual/ios_library/images/100000000000030C000001E61DFDBF76.png differ
diff --git a/developer_manual/ios_library/images/100000000000030C000001E637605044.png b/developer_manual/ios_library/images/100000000000030C000001E637605044.png
new file mode 100644
index 0000000..5d58db9
Binary files /dev/null and b/developer_manual/ios_library/images/100000000000030C000001E637605044.png differ
diff --git a/developer_manual/ios_library/images/100000000000030C000001E7A7A01884.png b/developer_manual/ios_library/images/100000000000030C000001E7A7A01884.png
new file mode 100644
index 0000000..606b6cd
Binary files /dev/null and b/developer_manual/ios_library/images/100000000000030C000001E7A7A01884.png differ
diff --git a/developer_manual/ios_library/images/100000000000030C000001E8AB4C3306.png b/developer_manual/ios_library/images/100000000000030C000001E8AB4C3306.png
new file mode 100644
index 0000000..8be0c83
Binary files /dev/null and b/developer_manual/ios_library/images/100000000000030C000001E8AB4C3306.png differ
diff --git a/developer_manual/ios_library/images/100000000000030C000001ECB85120C2.png b/developer_manual/ios_library/images/100000000000030C000001ECB85120C2.png
new file mode 100644
index 0000000..11339b8
Binary files /dev/null and b/developer_manual/ios_library/images/100000000000030C000001ECB85120C2.png differ
diff --git a/developer_manual/ios_library/images/10000201000003430000020C65A3C5A7.png b/developer_manual/ios_library/images/10000201000003430000020C65A3C5A7.png
new file mode 100644
index 0000000..455e6d9
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003430000020C65A3C5A7.png differ
diff --git a/developer_manual/ios_library/images/100002010000034700000211B6BE4A2B.png b/developer_manual/ios_library/images/100002010000034700000211B6BE4A2B.png
new file mode 100644
index 0000000..d71b482
Binary files /dev/null and b/developer_manual/ios_library/images/100002010000034700000211B6BE4A2B.png differ
diff --git a/developer_manual/ios_library/images/10000201000003480000020EC688993D.png b/developer_manual/ios_library/images/10000201000003480000020EC688993D.png
new file mode 100644
index 0000000..53a7931
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003480000020EC688993D.png differ
diff --git a/developer_manual/ios_library/images/10000201000003B9000002B619E44B0C.png b/developer_manual/ios_library/images/10000201000003B9000002B619E44B0C.png
new file mode 100644
index 0000000..fa5cbd9
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003B9000002B619E44B0C.png differ
diff --git a/developer_manual/ios_library/images/10000201000003B9000002B66AC4279B.png b/developer_manual/ios_library/images/10000201000003B9000002B66AC4279B.png
new file mode 100644
index 0000000..cfdf947
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003B9000002B66AC4279B.png differ
diff --git a/developer_manual/ios_library/images/10000201000003B9000002B68F027979.png b/developer_manual/ios_library/images/10000201000003B9000002B68F027979.png
new file mode 100644
index 0000000..fdecd6c
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003B9000002B68F027979.png differ
diff --git a/developer_manual/ios_library/images/10000201000003B9000002B69A5110D2.png b/developer_manual/ios_library/images/10000201000003B9000002B69A5110D2.png
new file mode 100644
index 0000000..da8a9ba
Binary files /dev/null and b/developer_manual/ios_library/images/10000201000003B9000002B69A5110D2.png differ
diff --git a/developer_manual/ios_library/images/100002010000046D000002B55ECA38D5.png b/developer_manual/ios_library/images/100002010000046D000002B55ECA38D5.png
new file mode 100644
index 0000000..b8c4433
Binary files /dev/null and b/developer_manual/ios_library/images/100002010000046D000002B55ECA38D5.png differ
diff --git a/developer_manual/ios_library/index.rst b/developer_manual/ios_library/index.rst
new file mode 100644
index 0000000..849bfee
--- /dev/null
+++ b/developer_manual/ios_library/index.rst
@@ -0,0 +1,25 @@
+===========================
+iOS Application Development
+===========================
+
+This document will describe how to the use ownCloud iOS library. The ownCloud
+iOS library for iOS allows a developer to communicate with any ownCloud server;
+among the features included are file synchronization, upload and download of
+files, delete rename and move of files and folders and share files or folders
+by link among others.
+
+This library may be added to a project and seamlessly integrates any
+application with ownCloud.
+
+The tool needed is Xcode 5, this guide includes some screenshots showing
+examples in Xcode 5.
+
+.. _iosindex:
+
+.. toctree::
+ :maxdepth: 1
+ :hidden:
+
+ library_installation
+ examples
+
diff --git a/developer_manual/ios_library/library_installation.rst b/developer_manual/ios_library/library_installation.rst
new file mode 100644
index 0000000..7ec5569
--- /dev/null
+++ b/developer_manual/ios_library/library_installation.rst
@@ -0,0 +1,133 @@
+Library Installation
+====================
+
+Obtaining the library
+---------------------
+
+The ownCloud iOS library may be obtained from the following Github repository:
+
+`git at github.com:owncloud/ios-library.git
+<mailto:git at github.com:owncloud/ios-library.git>`_
+
+Once obtained, this code should be compiled with Xcode 5. The Github
+repository not only contains the library, ownCloud iOS library, but also
+contains a sample project, OCLibraryExample, which will assist in learning how
+to use the library.
+
+Add the library to a project
+----------------------------
+
+There are two methods to add this library to a project.
+
+* Reference the headers and library binary file (``.a``) directly.
+* Include the library as a subproject.
+
+
+Which method to choose depends on user preference as well as whether the source
+code and project file of the static library are available.
+
+Reference headers and library binary files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Follow these steps if this is the desired method.
+
+1. Compile the ownCloud iOS library and run the project. A ``libownCloudiOS.a``
+file will be generated.
+
+The following files are required:
+
+**Library file**
+
+* ``libownCloudiOS.a`` (Library)
+
+**Library Classes**
+
+* ``OCCommunication.h`` (Accessors) Import in the communication class
+* ``OCErrorMsg.h`` (Error Messages) Import in the communication class
+* ``OCFileDto.h`` and ``OCFileDto.m`` (File/Folder object) Import when using
+* ``readFolder`` and ``readFile`` methods
+* ``OCFrameworkConstants.h`` (Customize constants)
+
+2. Add the library file to the project. From the “Build Phases” tab, scroll
+to “Link binary files” and select the ‘+’ to add a library. Select the library
+file.
+
+|10000201000003480000020EC688993D_png|
+
+3. Add the path of the library header files. Under the “Build Settings” tab,
+select the target library and add the path in the “Header Search Paths” field.
+
+|10000201000003430000020C65A3C5A7_png|
+
+4. Remaining in the “Build Setting” tab, add the flag ``-Obj-C`` under the
+“Other Linker Flags” option.
+
+|100002010000034700000211B6BE4A2B_png|
+
+At this stage, the library is included on your project and you can start
+communicating with the ownCloud server.
+
+Include the library as a subproject
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Follow these steps if this is the desired method.
+
+5. Add the file ``ownCloud iOS library.xcodeproj`` to the project via drag and
+drop.
+
+|100000000000030C000001E61DFDBF76_png|
+
+6. Within the project, navigate to the “Build Phases” tab. Under the “Target
+Dependencies” section, select the ‘+’ and choose the library target.
+
+|100000000000030C000001E7A7A01884_png|
+
+7. Link the library file to the project target. Under the “Build Phases” tab,
+select the ‘+’ under the “Link Binary with Libraries” section and select the
+library file.
+
+|100000000000030C000001E8AB4C3306_png|
+
+8. Add the flag ``-Obj-C`` to “Other Linker Flags” under the project target on
+the “Build Settings” tab.
+
+|100000000000030C000001ECB85120C2_png|
+
+9. Finally add the path of the library headers. Under the “Build Settings”
+tab, add the path under the “Header Search Paths” option.
+
+|100000000000030C000001E637605044_png|
+
+Sources
+-------
+
+* `Creating a static library in iOS tutorial (raywenderlich.com)`_
+* `Apple iOS static library documentation`_
+
+.. |100000000000030C000001E61DFDBF76_png| image:: images/100000000000030C000001E61DFDBF76.png
+ :width: 16.51cm
+ :height: 10.285cm
+.. |100002010000034700000211B6BE4A2B_png| image:: images/100002010000034700000211B6BE4A2B.png
+ :width: 16.261cm
+ :height: 10.246cm
+.. |100000000000030C000001E7A7A01884_png| image:: images/100000000000030C000001E7A7A01884.png
+ :width: 16.51cm
+ :height: 12.023cm
+.. |10000201000003480000020EC688993D_png| image:: images/10000201000003480000020EC688993D.png
+ :width: 16.51cm
+ :height: 10.329cm
+.. |100000000000030C000001E8AB4C3306_png| image:: images/100000000000030C000001E8AB4C3306.png
+ :width: 14.605cm
+ :height: 9.137cm
+.. |10000201000003430000020C65A3C5A7_png| image:: images/10000201000003430000020C65A3C5A7.png
+ :width: 16.51cm
+ :height: 10.358cm
+.. |100000000000030C000001E637605044_png| image:: images/100000000000030C000001E637605044.png
+ :width: 14.605cm
+ :height: 9.098cm
+.. |100000000000030C000001ECB85120C2_png| image:: images/100000000000030C000001ECB85120C2.png
+ :width: 14.605cm
+ :height: 9.211cm
+
+.. _`Creating a static library in iOS tutorial (raywenderlich.com)`: http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial
+.. _`Apple iOS static library documentation`: https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/Articles/configuration.html#/apple_ref/doc/uid/TP40012554-CH3-SW2
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-doc.git
More information about the Pkg-owncloud-commits
mailing list