Skip to content

Instantly share code, notes, and snippets.

@laiso
Created August 26, 2009 07:19
Show Gist options
  • Save laiso/175362 to your computer and use it in GitHub Desktop.
Save laiso/175362 to your computer and use it in GitHub Desktop.
diff --git a/Classes/WebViewController.m b/Classes/WebViewController.m
index b7228e2..e54e029 100644
--- a/Classes/WebViewController.m
+++ b/Classes/WebViewController.m
@@ -42,16 +42,15 @@ static NSObject *webViewcreateWebViewWithRequestIMP(id self, SEL _cmd, NSObject*
- (void)_loadPageInfo {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSURL *webServiceURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://b.hatena.ne.jp/entry/json/%@", pageURL]];
+ NSURL *webServiceURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://b.hatena.ne.jp/entry/jsonlite/%@", pageURL]];
NSURLRequest *req = [NSURLRequest requestWithURL:webServiceURL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30];
NSData *data;
NSHTTPURLResponse *res;
NSError *error;
data = [NSURLConnection sendSynchronousRequest:req returningResponse:&res error:&error];
-
- NSString *temp = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
- NSString *json = [[temp substringFromIndex:1] substringToIndex:[temp length] -2];
+
+ NSString *json = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
pageInfo = [[json JSONValue] retain];
[[[self navigationItem] rightBarButtonItem] setEnabled:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment