Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Add documentation about Objective-C blocks support
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Farache committed Jul 31, 2014
1 parent d5b2da6 commit d2a0a06
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Session session = new SessionImpl("http://10.0.2.2:8080");
However, most portal remote methods don't accept unauthenticated remote calls,
you will get a `Authentication required` exception message in most cases.

This will work only if the remote method on the portal or your plugin has the
This will only work if the remote method on the portal or your plugin has the
`@AccessControlled` annotation just before the method:

```java
Expand Down
27 changes: 27 additions & 0 deletions ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [Use](#use)
* [Unauthenticated session](#unauthenticated-session)
* [Asynchronous](#asynchronous)
* [Blocks](#blocks)
* [Batch](#batch)
* [Non-primitive arguments](#non-primitive-arguments)
* [OrderByComparator](#orderbycomparator)
Expand Down Expand Up @@ -242,6 +243,32 @@ safely. In this example, the `getGroupEntriesWithGroupId` method returns a

`onSuccess` is called on the main UI thread after the request has finished.

##### Blocks

It is also possible to use Objective-C blocks as callbacks:

```objective-c
LRSession *session = [[LRSession alloc] initWithServer:@"http://localhost:8080" username:@"[email protected]" password:@"test"];

[session
onSuccess:^(id result) {
// Called after request has finished successfully
}
onFailure:^(NSError *e) {
// Implement error handling code
}
];

LRGroupService_v62 *service = [[LRGroupService_v62 alloc] initWithSession:session];

NSError *error;
[service getUserSites:&error];
```
Do not set a `LRCallback` to the session in this case, otherwise it will get
overriden. Blocks support works the same way as described in the previous
section.
#### Batch
The SDK allows sending requests using batch processing, which can be much more
Expand Down

0 comments on commit d2a0a06

Please sign in to comment.