Permalink
Browse files

Add example code using MBRYouTubeRequest.

  • Loading branch information...
1 parent d798a1f commit d8068a4c10be90fca32046125a1b23a1eb9bfeeb @scelis scelis committed May 30, 2012
Showing with 21 additions and 0 deletions.
  1. +21 −0 README.md
View
@@ -67,6 +67,27 @@ Even though it is possible to download JSON data directly with `MBJSONRequest` (
* [`MBRYouTubeRequest.h`][MBRYouTubeRequest.h]
* [`MBRYouTubeRequest.m`][MBRYouTubeRequest.m]
+Using this class would simplify the above example as follows:
+
+```objc
+MBRYouTubeRequest *request = [[[MBRYouTubeRequest alloc] init] autorelease];
+[request requestTopRatedVideosFromIndex:1
+ maxResults:20
+ completionHandler:^(NSArray *videos, NSError *error) {
+ if (error != nil)
+ {
+ NSLog(@"Error: %@", error);
+ }
+ else
+ {
+ for (MBRVideo *video in videos)
+ {
+ NSLog(@"'%@' by %@", [video title], [video author]);
+ }
+ }
+ }];
+```
+
## ARC Support
MBRequest and MBCommon do not currently support [ARC (Automatic Reference Counting)][ARC]. This may change in the future. For now, if you are using ARC in your own projects, you will need to set the `-fno-objc-arc` compiler flag on all MBRequest and MBCommon files. To do this:

0 comments on commit d8068a4

Please sign in to comment.