Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // TumblrParseOperation.h
- // Tumblr Media Manager
- //
- // Created by Jose Luis Campaña Perez on 06/08/11.
- // Copyright 2011 iZ3. All rights reserved.
- // jose@iz3solutions.com
- //
- #import <Foundation/Foundation.h>
- @protocol TumblrParseOperationDelegate
- -(void)tumblrParseFinishOperationWithData:(NSMutableArray *)data;
- @end
- @interface TumblrParseOperation : NSOperation
- {
- id <TumblrParseOperationDelegate> _delegate;
- NSString *_jsonData;
- NSMutableArray *_listaDatos;
- }
- @end
- //
- // TumblrParseOperation.m
- // Tumblr Media Manager
- //
- // Created by Jose Luis Campaña Perez on 06/08/11.
- // Copyright 2011 iZ3. All rights reserved.
- // jose@iz3solutions.com
- //
- #import "TumblrParseOperation.h"
- @implementation TumblrParseOperation
- #pragma mark - INIT
- - (id)initWithData:(NSString *)jsonData delegate:(id <TumblrParseOperationDelegate>)delegate
- {
- self = [super init];
- if (self != nil)
- {
- _jsonData = jsonData;
- _delegate = delegate;
- _listaDatos = [[NSMutableArray alloc] init];
- }
- return self;
- }
- - (void)dealloc
- {
- [_jsonData release];
- [_listaDatos release];
- [super dealloc];
- }
- -(void)main
- {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- [self parse];
- if (![self isCancelled])
- {
- // notify our AppDelegate that the parsing is complete
- [_delegate tumblrParseFinishOperationWithData:_listaDatos];
- }
- [pool release];
- }
- -(void)parse
- {
- //The hardjob
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement