Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface Headparse : NSObject {
- NSMutableData *responseData;
- }
- @property (retain, nonatomic) NSMutableData *responseData;
- +(NSMutableArray *) getArrayFromDB : (NSString *)actionType :(NSMutableDictionary *) postData;
- +(NSMutableArray *) getArrayFromDB : (NSString *)actionType;
- +(NSMutableArray *) getArrayFromUrl: (NSString *)actionType;
- +(NSMutableArray *) getArrayFromUrl:(NSString *)actionType withData:(NSMutableDictionary *) postData;
- @end
- #import "Headparse.h"
- #import "JSON.h"
- #import "SBJsonParser.h"
- #import "Dataoperation.h"
- @implementation Headparse
- @synthesize responseData;
- +(NSMutableArray *) getArrayFromUrl: (NSString *)actionType
- {
- NSMutableData *responseData1= [NSMutableData data] ;
- responseData1 = [NSMutableData dataWithContentsOfURL:[NSURL URLWithString:actionType]];
- // NSLog(@"%@",responseData1);
- NSString *responseString1 = [[NSString alloc] initWithData:responseData1 encoding:NSUTF8StringEncoding];
- //NSLog(@"REs:-->%@",responseString1);
- //[responseData1 release];
- responseData1 = nil;
- NSMutableArray *responseArray = [[NSMutableArray alloc]init];
- responseArray = (NSMutableArray *)[responseString1 JSONValue];
- // NSLog(@"ghfchfvghv%@",responseArray);
- [responseString1 release];
- return responseArray;
- }
- +(NSMutableArray *) getArrayFromUrl:(NSString *)actionType withData:(NSMutableDictionary *) postData
- {
- int x=1;
- for(id key in [postData allKeys])
- {
- if([postData count]==x)
- {
- actionType = [actionType stringByAppendingFormat:@"%@=%@",key,[postData valueForKey:key]];
- }
- else {
- x++;
- actionType = [actionType stringByAppendingFormat:@"%@=%@&",key,[postData valueForKey:key]];
- }
- }
- NSMutableData *responseData1= [NSMutableData data];
- responseData1 = [NSMutableData dataWithContentsOfURL:[NSURL URLWithString:actionType]];
- NSString *responseString1 = [[NSString alloc] initWithData:responseData1 encoding:NSUTF8StringEncoding];
- responseData1 = nil;
- NSMutableArray *responseArray = [[NSMutableArray alloc]init];
- responseArray = (NSMutableArray *)[responseString1 JSONValue];
- [responseString1 release];
- return responseArray;
- }
- +(NSMutableArray *) getArrayFromDB : (NSString *)actionType :(NSMutableDictionary *) postData{
- // NSLog(@"ActionFile%@",[actionType description]);
- // NSLog(@"PostedData%@",[postData description]);
- NSString *sourceFile = [NSString stringWithFormat:@"%@",actionType];
- NSMutableDictionary *data = [[NSMutableDictionary alloc]init];
- [data addEntriesFromDictionary:postData];
- NSMutableArray *result=[[NSMutableArray alloc]init];
- result = [Dataoperation getData:sourceFile :data];
- // NSLog(@"resultData%@",[result description]);
- return result;
- }
- +(NSMutableArray *) getArrayFromDB : (NSString *)actionType{
- NSString *sourceFile = [NSString stringWithFormat:@"%@",actionType];
- NSMutableArray *result_Array = [[NSMutableArray alloc]init];
- result_Array = [Dataoperation getData:sourceFile :@""];
- // NSLog(@"%@",[result_Array description]);
- return result_Array;
- }
Advertisement
Add Comment
Please, Sign In to add comment