[Pkg-owncloud-commits] [owncloud-doc] 23/60: iOS library doc
David Prévot
taffit at moszumanska.debian.org
Tue Feb 25 19:06:55 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 48135bee455f7e24617801ef54496e334a85d1ac
Author: Raquel <rperez at solidgear.es>
Date: Tue Feb 18 19:25:03 2014 +0100
iOS library doc
---
developer_manual/ios_library/EXAMPLES.rst | 1537 ++++++++++++++++++++
developer_manual/ios_library/Introduction.rst | 10 +
.../ios_library/Library_Installation.rst | 203 +++
.../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 | 4 +
17 files changed, 1754 insertions(+)
diff --git a/developer_manual/ios_library/EXAMPLES.rst b/developer_manual/ios_library/EXAMPLES.rst
new file mode 100644
index 0000000..ddc3c4d
--- /dev/null
+++ b/developer_manual/ios_library/EXAMPLES.rst
@@ -0,0 +1,1537 @@
+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
+~~~~~~~~~~~~
+
+
++----------------------------+
+| #import |
+| "OCCommunication.h" |
+| |
+| + ( |
+| OCCommunication |
+| *)sharedOCCommunication |
+| |
+| { |
+| |
+| static |
+| |
+| OCCommunication |
+| * sharedOCCommunication = |
+| nil |
+| ; |
+| |
+| if |
+| (sharedOCCommunication == |
+| nil |
+| ) |
+| |
+| { |
+| |
+| sharedOCCommunication = [[ |
+| OCCommunication |
+| |
+| alloc |
+| ] |
+| init |
+| ]; |
+| |
+| } |
+| |
+| 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
+~~~~~~~~~~~~
+
+
++-----------------------------------------------+
+| #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
+~~~~~~~~~~~~
+
++----------------------------+
+| [[ |
+| 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
+~~~~~~~~~~~~
+
+
++----------------------------------------------------------+
+| [[ |
+| 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
+~~~~~~~~~~~~
+
+
++----------------------------+
+| [[ |
+| 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
+~~~~~~~~~~~~
+
+
++-------------------------------------------------+
+| |
+| [[ |
+| 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
+~~~~~~~~~~~~
+
++----------------------------+
+| |
+| [[ |
+| 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.
+
+Code example
+~~~~~~~~~~~~
+
+
++---------------------------------------------------------------+
+| |
+| __block |
+| |
+| NSOperation |
+| |
+| *op = |
+| nil |
+| ; |
+| |
+| op = [[ |
+| AppDelegate |
+| |
+| sharedOCCommunication |
+| ] |
+| downloadFile |
+| :remotePath |
+| toDestiny |
+| :localPath |
+| 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) { |
+| |
+| //Donwload 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 |
+| ]; |
+| |
+| }]; |
+| |
+| |
++---------------------------------------------------------------+
+
+
+
+
+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
+~~~~~~~~~~~~
+
++----------------------------------------------------+
+| __block |
+| |
+| 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) { |
+| |
+| //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.c |
+| ode |
+| ) { |
+| |
+| case |
+| |
+| OCErrorFileToUploadDoesNotExist |
+| : |
+| |
+| //File does not exist |
+| |
+| break |
+| ; |
+| |
+| default |
+| : |
+| |
+| //Default |
+| |
+| break |
+| ;} |
+| |
+| } |
+| shouldExecuteAsBackgroundTaskWithExpirationHandler |
+| :^{ |
+| |
+| [op |
+| cancel |
+| ]; |
+| |
+| }]; |
+| |
++----------------------------------------------------+
+
+
+Check if the server supports Sharing api
+----------------------------------------
+
+
+The S
+haring 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
+~~~~~~~~~~~~
+
++-----------------------+
+| [[ |
+| AppDelegate |
+| |
+| sharedOCCommunication |
+| ] |
+| hasServerShareSupport |
+| :_activeUser.url |
+| onCommunication |
+| :[ |
+| |
+| AppDelegate |
+| |
+| sharedOCCommunication |
+| ] |
+| successRequest |
+| :^( |
+| |
+| NSHTTPURLResponse |
+| |
+| *response, |
+| |
+| BOOL |
+| hasSupport, |
+| NSString |
+| |
+| *redirectedServer) { |
+| |
+| |
+| } |
+| failureRequest |
+| :^( |
+| NSHTTPURLResponse |
+| |
+| *response, |
+| NSError |
+| |
+| *error){ |
+| |
+| |
+| }]; |
+| |
+| } |
+| |
++-----------------------+
+
+
+Read shared 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
+~~~~~~~~~~~~
+
++-------------------------+
+| [[ |
+| 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); |
+| |
+| }]; |
+| |
++-------------------------+
+
+
+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
+~~~~~~~~~~~~
+
+
++-------------------------------------------------------------------------------------+
+| [[ |
+| 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
+~~~~~~~~~~~~
+
+
++-----------------------------+
+| [[ |
+| AppDelegate |
+| |
+| sharedOCCommunication |
+| ] |
+| unShareFileOrFolderByServer |
+| :path |
+| |
+| andIdRemoteSharedShared |
+| :sharedByLink. |
+| idRemoteShared |
+| |
+| onCommunication |
+| :[ |
+| AppDelegate |
+| |
+| sharedOCCommunication |
+| ] |
+| successRequest |
+| :^( |
+| NSHTTPURLResponse |
+| |
+| *response, |
+| NSString |
+| |
+| *redirectedServer) { |
+| |
+| //File unshared |
+| |
+| } |
+| failureRequest |
+| :^( |
+| NSHTTPURLResponse |
+| |
+| *response, |
+| NSError |
+| |
+| *error){ |
+| |
+| //Error |
+| |
+| }]; |
+| |
++-----------------------------+
+
+
+
+
+
+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 <http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop>`_
+Music/
+
+* Wrong path:
+`http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop%20Music/ <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/Introduction.rst b/developer_manual/ios_library/Introduction.rst
new file mode 100644
index 0000000..5a592c5
--- /dev/null
+++ b/developer_manual/ios_library/Introduction.rst
@@ -0,0 +1,10 @@
+Introduction
+============
+
+
+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 xCode5, this guide includes some screenshots showing examples in xCode5.
diff --git a/developer_manual/ios_library/Library_Installation.rst b/developer_manual/ios_library/Library_Installation.rst
new file mode 100644
index 0000000..49e9058
--- /dev/null
+++ b/developer_manual/ios_library/Library_Installation.rst
@@ -0,0 +1,203 @@
+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.
+
+#. 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)
+
+
+
+
+#. 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|
+
+
+
+#. 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|
+
+#. 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.
+
+#. Add the file “ownCloud iOS library.xcodeproj” to the project via drag and drop.
+
+
+
+|100000000000030C000001E61DFDBF76_png|
+
+
+#. Within the project, navigate to the “Build Phases” tab.
+ Under the “Target Dependencies” section, select the ‘+’ and choose the library target.
+
+
+
+
+|100000000000030C000001E7A7A01884_png|
+
+
+
+#. 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|
+
+
+
+#. Add the flag “-Obj-C” to “Other Linker Flags” under the project target on the “Build Settings” tab.
+
+
+
+
+|100000000000030C000001ECB85120C2_png|
+
+
+
+#. Finally add the path of the library headers.
+ Under the “Build Settings” tab, add the path under the “Header Search Paths” option.
+
+
+
+
+|100000000000030C000001E637605044_png|
+
+
+Source
+:
+
+raywenderlich.com
+` http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial <http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial>`_
+
+Apple.com
+`https://developer.apple.com/library/ios/technotes/iOSStaticLibraries/Articles/configuration.html#/apple_ref/doc/uid/TP40012554-CH3-SW2 <#/apple_ref/doc/uid/TP40012554-CH3-SW2>`_
+
+
+.. |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
+
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..eecb651
--- /dev/null
+++ b/developer_manual/ios_library/index.rst
@@ -0,0 +1,4 @@
+Index
+=====
+
+
--
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