Browse files

Second Commit

Change callback type to id
  • Loading branch information...
1 parent 9ad9eb5 commit 274ec54f1bab6d5116d0af9bdcef522007635613 @Nuclominus committed Feb 25, 2014
View
2 StartNetwork/NetworkRequest/NetworkRequestClass.h
@@ -12,7 +12,7 @@
#import "CDFileManager.h"
@protocol NetworkRequestDelegate <NSObject>
--(void)requestAnswer:(NSMutableArray*)answer withID:(int)tag;
+-(void)requestAnswer:(id)answer withID:(int)tag;
@end
View
2 StartNetwork/NetworkRequest/NetworkRequestClass.m
@@ -45,7 +45,7 @@ - (void)requestStarted:(ASIHTTPRequest *)request{
}
- (void)requestFinished:(ASIHTTPRequest *)request {
- NSMutableArray *respone = [NSJSONSerialization JSONObjectWithData:request.responseData options:NSJSONReadingMutableContainers error:nil];
+ id respone = [NSJSONSerialization JSONObjectWithData:request.responseData options:NSJSONReadingMutableContainers error:nil];
if (cash) {
[CDFileManager writeToFile:saveByName arrayToFile:respone];
}
View
4 StartNetwork/ViewController.m
@@ -23,12 +23,14 @@ - (void)viewDidLoad
// url
requestObject.urlRequest = @"";
// id/tag request need if we have more the one requests
+ // use some enum
requestObject.idRequest = 1;
requestObject.typeRequest = @"POST";
// some parms if need
[requestObject.paremsRequest setObject:[NSNumber numberWithInt:876] forKey:@""];
// save data to device
requestObject.cashing = YES;
+ // name by save .plist
requestObject.nameRequest = @"First_Request";
network = [[NetworkRequestClass alloc]init];
@@ -37,7 +39,7 @@ - (void)viewDidLoad
}
#pragma mark - Network answer
--(void)requestAnswer:(NSMutableArray *)answer withID:(int)tag{
+-(void)requestAnswer:(id)answer withID:(int)tag{
NSLog(@"respone %d ===> %@",tag,answer);
}
#pragma mark -

0 comments on commit 274ec54

Please sign in to comment.