Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/probablycorey/seriously
The Objective-C HTTP library that Apple should have created, seriously.
https://github.com/probablycorey/seriously
Last synced: 19 days ago
JSON representation
The Objective-C HTTP library that Apple should have created, seriously.
- Host: GitHub
- URL: https://github.com/probablycorey/seriously
- Owner: probablycorey
- License: other
- Created: 2010-06-28T21:58:13.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2020-12-21T20:05:07.000Z (almost 4 years ago)
- Last Synced: 2024-11-16T21:05:39.353Z (27 days ago)
- Language: C
- Homepage:
- Size: 101 KB
- Stars: 435
- Watchers: 4
- Forks: 31
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome - seriously - The Objective-C HTTP library that Apple should have created, seriously. (etc)
- awesome - seriously - The Objective-C HTTP library that Apple should have created, seriously. (etc)
README
Seriously
---------
The iPhone needs a better way to make HTTP requests, specifically calls to
REST web services. Seriously mixes Blocks with NSURLConnection &
NSOperationQueue to do just that. It also will automatically parse the JSON
response into a dictionary if the response headers are set correctly.Install
-------
Just drag the files from the "src" directory into your project. You can also try
using the included "Seriously.framework" fileParse JSON EXAMPLE
------------------
NSString *url = @"http://api.twitter.com/1/users/show.json?screen_name=probablycorey";[Seriously get:url handler:^(id body, NSHTTPURLResponse *response, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
}
else {
NSLog(@"Look, JSON is parsed into a dictionary!");
NSLog(@"%@", [body objectForKey:@"profile_background_image_url"]);
}
}];Simple Queue Example
--------------------
NSArray *urls = [NSArray arrayWithObjects:
@"http://farm5.static.flickr.com/4138/4744205956_1f08ae40e3_o.jpg",
@"http://farm5.static.flickr.com/4123/4744238252_d11d0df5a3_b.jpg",
@"http://farm5.static.flickr.com/4097/4743596319_50cce97d80_o.jpg",
@"http://farm5.static.flickr.com/4099/4743581287_7c50529b36_o.jpg",
@"http://farm5.static.flickr.com/4123/4743587437_78f0906e8a_o.jpg",
@"http://farm5.static.flickr.com/4136/4743562971_d5f5c6d5b1_o.jpg",
@"http://farm5.static.flickr.com/4073/4744205142_be44e64ab7_o.jpg",
nil];// By default the NSOperation will only do 3 requests at a time
for (NSString *url in urls) {
NSOperation *o = [Seriously request:url options:nil handler:^(id body,
NSHTTPURLResponse *response, NSError *error) {
NSLog(@"got %d (%@)", [urls indexOfObject:url], url);
}];
}
Why Are You Using Blocks?
-------------------------
Welcome to the future dude!
TODO
----
- Document
- Add XML parsing
- Add more options for NSOperationQueue managementCurrently Maintained By:
------------------------
[@adamvduke](https://github.com/adamvduke)