Merge branch 'develop' into 'master'
- Fix Respose Error grab data See merge request !22
This commit is contained in:
commit
f2885301b9
@ -33,14 +33,7 @@
|
|||||||
[[PNObjectConfig sharedInstance] setEnvironment:Stage];
|
[[PNObjectConfig sharedInstance] setEnvironment:Stage];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
User *user = [User currentUser];
|
|
||||||
[user setFirstName:@"Giuseppe"];
|
|
||||||
[user setLastName:@"Nuficora"];
|
|
||||||
[user setEmail:@"giuseppe.nucifora@purplenetwork.it"];
|
|
||||||
[user setPassword:@"asdasdasd"];
|
|
||||||
[user setConfirmPassword:@"asdasdasd"];
|
|
||||||
|
|
||||||
|
|
||||||
PNObjectViewController *viewController = [[PNObjectViewController alloc] init];
|
PNObjectViewController *viewController = [[PNObjectViewController alloc] init];
|
||||||
|
|
||||||
_window.rootViewController = viewController;
|
_window.rootViewController = viewController;
|
||||||
|
|||||||
@ -101,7 +101,16 @@
|
|||||||
|
|
||||||
- (void) apiCallAction {
|
- (void) apiCallAction {
|
||||||
|
|
||||||
[[User currentUser] registerCurrentUserWithBlockSuccess:^(id _Nullable responseObject) {
|
User *user = [User currentUser];
|
||||||
|
[user setFirstName:@"Giuseppe"];
|
||||||
|
[user setLastName:@"Nuficora"];
|
||||||
|
[user setEmail:@"giuseppe.nucifora@purplenetwork.it"];
|
||||||
|
[user setPassword:@"asdasdasd"];
|
||||||
|
[user setConfirmPassword:@"asdasdasd"];
|
||||||
|
[user setHasAcceptedNewsletter:NO];
|
||||||
|
[user setHasAcceptedPrivacy:YES];
|
||||||
|
|
||||||
|
[user registerCurrentUserWithBlockSuccess:^(id _Nullable responseObject) {
|
||||||
|
|
||||||
} failure:^(NSError * _Nonnull error) {
|
} failure:^(NSError * _Nonnull error) {
|
||||||
|
|
||||||
|
|||||||
16
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
16
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
@ -123,6 +123,8 @@
|
|||||||
67459AD239EF669A365519E06B45DCFE /* EXPExpect.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B934B7F86B106DF78204B7AE8B8EC3 /* EXPExpect.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
67459AD239EF669A365519E06B45DCFE /* EXPExpect.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B934B7F86B106DF78204B7AE8B8EC3 /* EXPExpect.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
68152D921ABF6A423C192C04FDF94F0F /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F0F90EF4748B4A966D1DAF164931F4 /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
68152D921ABF6A423C192C04FDF94F0F /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F0F90EF4748B4A966D1DAF164931F4 /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
68527B0A6AE982293383787B56E689CE /* SPTSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 46FE1251C9E029D9BAE495F559EAE792 /* SPTSpec.m */; };
|
68527B0A6AE982293383787B56E689CE /* SPTSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 46FE1251C9E029D9BAE495F559EAE792 /* SPTSpec.m */; };
|
||||||
|
686ABCD31C68BB14000B3F7A /* AFJSONResponseSerializerWithData.h in Headers */ = {isa = PBXBuildFile; fileRef = 686ABCD11C68BB14000B3F7A /* AFJSONResponseSerializerWithData.h */; };
|
||||||
|
686ABCD41C68BB14000B3F7A /* AFJSONResponseSerializerWithData.m in Sources */ = {isa = PBXBuildFile; fileRef = 686ABCD21C68BB14000B3F7A /* AFJSONResponseSerializerWithData.m */; };
|
||||||
68A38977EBAE334DC3C22386D00D2622 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8896632DE267959FC9A58A136F288D51 /* AFNetworkReachabilityManager.m */; };
|
68A38977EBAE334DC3C22386D00D2622 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8896632DE267959FC9A58A136F288D51 /* AFNetworkReachabilityManager.m */; };
|
||||||
6D5A30E2A230B959E8EE809CE4BB32A2 /* PNObjectConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E302FEB8D6267D5AFF079585825E1ED7 /* PNObjectConfig.m */; };
|
6D5A30E2A230B959E8EE809CE4BB32A2 /* PNObjectConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E302FEB8D6267D5AFF079585825E1ED7 /* PNObjectConfig.m */; };
|
||||||
6DB00E9E820B5D01AB879D6D6C5761D0 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = AE755B3A0FB88230CB157960D30465F3 /* ALView+PureLayout.m */; };
|
6DB00E9E820B5D01AB879D6D6C5761D0 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = AE755B3A0FB88230CB157960D30465F3 /* ALView+PureLayout.m */; };
|
||||||
@ -692,6 +694,8 @@
|
|||||||
659A88606C2EB56A078B8000BF3C76EF /* NSValue+Expecta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSValue+Expecta.h"; path = "Expecta/NSValue+Expecta.h"; sourceTree = "<group>"; };
|
659A88606C2EB56A078B8000BF3C76EF /* NSValue+Expecta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSValue+Expecta.h"; path = "Expecta/NSValue+Expecta.h"; sourceTree = "<group>"; };
|
||||||
665CA3EDF757B11180E35A2B3C4109A7 /* EXPMatchers+beSubclassOf.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "EXPMatchers+beSubclassOf.m"; path = "Expecta/Matchers/EXPMatchers+beSubclassOf.m"; sourceTree = "<group>"; };
|
665CA3EDF757B11180E35A2B3C4109A7 /* EXPMatchers+beSubclassOf.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "EXPMatchers+beSubclassOf.m"; path = "Expecta/Matchers/EXPMatchers+beSubclassOf.m"; sourceTree = "<group>"; };
|
||||||
681D38A1CD2CBD39B4504C4812CB0AAE /* CodFis_Helper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CodFis_Helper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
681D38A1CD2CBD39B4504C4812CB0AAE /* CodFis_Helper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CodFis_Helper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
686ABCD11C68BB14000B3F7A /* AFJSONResponseSerializerWithData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFJSONResponseSerializerWithData.h; sourceTree = "<group>"; };
|
||||||
|
686ABCD21C68BB14000B3F7A /* AFJSONResponseSerializerWithData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFJSONResponseSerializerWithData.m; sourceTree = "<group>"; };
|
||||||
686B13BFDA57BED5365B141F8035571A /* UIDevice-Utils-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIDevice-Utils-prefix.pch"; sourceTree = "<group>"; };
|
686B13BFDA57BED5365B141F8035571A /* UIDevice-Utils-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIDevice-Utils-prefix.pch"; sourceTree = "<group>"; };
|
||||||
68888A8DB78EC8BACCB7D5CB3E6FE473 /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLRequestSerialization.h; path = AFNetworking/AFURLRequestSerialization.h; sourceTree = "<group>"; };
|
68888A8DB78EC8BACCB7D5CB3E6FE473 /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLRequestSerialization.h; path = AFNetworking/AFURLRequestSerialization.h; sourceTree = "<group>"; };
|
||||||
68AD8EB00582BE9183A47EBF5778229F /* CodFis-Helper-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CodFis-Helper-umbrella.h"; sourceTree = "<group>"; };
|
68AD8EB00582BE9183A47EBF5778229F /* CodFis-Helper-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CodFis-Helper-umbrella.h"; sourceTree = "<group>"; };
|
||||||
@ -1151,6 +1155,7 @@
|
|||||||
09DFBEE319FF263B46BE993205A73171 /* Vendors */ = {
|
09DFBEE319FF263B46BE993205A73171 /* Vendors */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
686ABCD01C68BADF000B3F7A /* AFJSONResponseSerializerWithData */,
|
||||||
D59DE6098AB18223462166121D3EF123 /* AFOAuth2Manager */,
|
D59DE6098AB18223462166121D3EF123 /* AFOAuth2Manager */,
|
||||||
);
|
);
|
||||||
path = Vendors;
|
path = Vendors;
|
||||||
@ -1461,6 +1466,15 @@
|
|||||||
name = UIKit;
|
name = UIKit;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
686ABCD01C68BADF000B3F7A /* AFJSONResponseSerializerWithData */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
686ABCD11C68BB14000B3F7A /* AFJSONResponseSerializerWithData.h */,
|
||||||
|
686ABCD21C68BB14000B3F7A /* AFJSONResponseSerializerWithData.m */,
|
||||||
|
);
|
||||||
|
path = AFJSONResponseSerializerWithData;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
729C4611053B78A0900E14D5E1734624 /* Classes */ = {
|
729C4611053B78A0900E14D5E1734624 /* Classes */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -1885,6 +1899,7 @@
|
|||||||
0F1F7C0A6EC86A3FCF1BB0B073A097DD /* PNLocation.h in Headers */,
|
0F1F7C0A6EC86A3FCF1BB0B073A097DD /* PNLocation.h in Headers */,
|
||||||
5CDCF5E6A1A6BC03466189CB90B0D256 /* PNObject+PNObjectConnection.h in Headers */,
|
5CDCF5E6A1A6BC03466189CB90B0D256 /* PNObject+PNObjectConnection.h in Headers */,
|
||||||
34C796D4FBF079C1EE491183EA1A6FEC /* PNObject+Protected.h in Headers */,
|
34C796D4FBF079C1EE491183EA1A6FEC /* PNObject+Protected.h in Headers */,
|
||||||
|
686ABCD31C68BB14000B3F7A /* AFJSONResponseSerializerWithData.h in Headers */,
|
||||||
44C7743BBE4CCB5065BDE9C1216B5DC9 /* PNObject-umbrella.h in Headers */,
|
44C7743BBE4CCB5065BDE9C1216B5DC9 /* PNObject-umbrella.h in Headers */,
|
||||||
847EED4B0EA774785C68431817CD93C9 /* PNObject.h in Headers */,
|
847EED4B0EA774785C68431817CD93C9 /* PNObject.h in Headers */,
|
||||||
E9D106AFF48125A694CE99CCA5D7A157 /* PNObjectConfig.h in Headers */,
|
E9D106AFF48125A694CE99CCA5D7A157 /* PNObjectConfig.h in Headers */,
|
||||||
@ -2902,6 +2917,7 @@
|
|||||||
8A2A0069F4D5044BE03B3F39CC374519 /* AFOAuthCredential.m in Sources */,
|
8A2A0069F4D5044BE03B3F39CC374519 /* AFOAuthCredential.m in Sources */,
|
||||||
D2ED781E66AD5CD401EBC86CD03E9C27 /* PNAddress.m in Sources */,
|
D2ED781E66AD5CD401EBC86CD03E9C27 /* PNAddress.m in Sources */,
|
||||||
735F937F3E969009D5F40CB33909BF63 /* PNInstallation.m in Sources */,
|
735F937F3E969009D5F40CB33909BF63 /* PNInstallation.m in Sources */,
|
||||||
|
686ABCD41C68BB14000B3F7A /* AFJSONResponseSerializerWithData.m in Sources */,
|
||||||
AC1BD14C511A7825CEB0753CFAE51C6D /* PNLocation.m in Sources */,
|
AC1BD14C511A7825CEB0753CFAE51C6D /* PNLocation.m in Sources */,
|
||||||
9AEC0D13C5E01C1B225458FE03A15CDE /* PNObject+PNObjectConnection.m in Sources */,
|
9AEC0D13C5E01C1B225458FE03A15CDE /* PNObject+PNObjectConnection.m in Sources */,
|
||||||
1D0DF59F3721D214418AE5F859BA6A94 /* PNObject+Protected.m in Sources */,
|
1D0DF59F3721D214418AE5F859BA6A94 /* PNObject+Protected.m in Sources */,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "PNObject"
|
s.name = "PNObject"
|
||||||
s.version = "0.3.4"
|
s.version = "0.3.5"
|
||||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||||
|
|
||||||
# This description is used to generate tags and improve search results.
|
# This description is used to generate tags and improve search results.
|
||||||
|
|||||||
@ -135,9 +135,7 @@ static bool isFirstAccess = YES;
|
|||||||
[self saveLocally];
|
[self saveLocally];
|
||||||
}
|
}
|
||||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
if (failure) {
|
NSLogDebug(@"error : %ld",[error code]);
|
||||||
failure(error);
|
|
||||||
}
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
@implementation PNObject (PNObjectConnection)
|
@implementation PNObject (PNObjectConnection)
|
||||||
|
|
||||||
+ (void) GETWithProgress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
+ (void) GETWithProgress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject))success
|
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||||
|
|
||||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
+ (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||||
Progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
Progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject))success
|
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||||
|
|
||||||
|
|
||||||
@ -83,14 +83,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void) POSTWithProgress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
|
||||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject))success
|
|
||||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
- (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||||
Progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
Progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject))success
|
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject))success
|
||||||
@ -100,15 +92,19 @@
|
|||||||
|
|
||||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingFormat:@"%@",endPoint] parameters:[self JSONFormObject] progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingFormat:@"%@",endPoint] parameters:[self JSONFormObject] progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||||
|
|
||||||
id PNObjectResponse = [[[self class] alloc] initWithJSON:[responseObject copy]];
|
id PNObjectResponse;
|
||||||
|
if (responseObject) {
|
||||||
|
PNObjectResponse = [[[self class] alloc] initWithJSON:[responseObject copy]];
|
||||||
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
success(task,PNObjectResponse);
|
success(task,PNObjectResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
|
|
||||||
if (failure) {
|
if (failure) {
|
||||||
failure(task,error);
|
failure(task, error);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@ -118,11 +114,23 @@
|
|||||||
[self POSTWithEndpointAction:endPoint Progress:uploadProgress success:success failure:failure];
|
[self POSTWithEndpointAction:endPoint Progress:uploadProgress success:success failure:failure];
|
||||||
} failure:^(NSError * _Nonnull error) {
|
} failure:^(NSError * _Nonnull error) {
|
||||||
|
|
||||||
|
if (failure) {
|
||||||
|
failure(nil,error);
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+ (NSError* _Nonnull) getErrorFromTask:(NSURLSessionDataTask* _Nonnull) task andError:(NSError * _Nonnull) error {
|
||||||
|
|
||||||
|
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
|
||||||
|
NSData *errorData = error.userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey];
|
||||||
|
NSDictionary *serializedData = [NSJSONSerialization JSONObjectWithData: errorData options:kNilOptions error:nil];
|
||||||
|
|
||||||
|
return [NSError errorWithDomain:[error domain] code:response.statusCode userInfo:serializedData];
|
||||||
|
}
|
||||||
/*+ (nullable NSURLSessionDataTask *) POSTConstructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> _Nonnull formData))block
|
/*+ (nullable NSURLSessionDataTask *) POSTConstructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> _Nonnull formData))block
|
||||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#import "PNObjectConfig.h"
|
#import "PNObjectConfig.h"
|
||||||
#import "PNObjectConstants.h"
|
#import "PNObjectConstants.h"
|
||||||
#import "PNUser.h"
|
#import "PNUser.h"
|
||||||
|
#import "AFJSONResponseSerializerWithData.h"
|
||||||
|
|
||||||
|
|
||||||
NSString * const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess = @"PNObjectLocalNotificationRefreshTokenClientCredentialSuccess";
|
NSString * const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess = @"PNObjectLocalNotificationRefreshTokenClientCredentialSuccess";
|
||||||
@ -218,7 +219,9 @@ static bool isFirstAccess = YES;
|
|||||||
[self refreshTokenForClientCredential];
|
[self refreshTokenForClientCredential];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_manager.responseSerializer = [AFJSONResponseSerializerWithData serializer];
|
||||||
|
|
||||||
return _manager;
|
return _manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// AFJSONResponseSerializerWithData.h
|
||||||
|
// Pods
|
||||||
|
//
|
||||||
|
// Created by Giuseppe Nucifora on 08/02/16.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <AFNetworking/AFNetworking.h>
|
||||||
|
|
||||||
|
static NSString * const JSONResponseSerializerWithDataKey = @"JSONResponseSerializerWithDataKey";
|
||||||
|
|
||||||
|
@interface AFJSONResponseSerializerWithData : AFJSONResponseSerializer
|
||||||
|
|
||||||
|
@end
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// AFJSONResponseSerializerWithData.m
|
||||||
|
// Pods
|
||||||
|
//
|
||||||
|
// Created by Giuseppe Nucifora on 08/02/16.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AFJSONResponseSerializerWithData.h"
|
||||||
|
|
||||||
|
@implementation AFJSONResponseSerializerWithData
|
||||||
|
|
||||||
|
- (id)responseObjectForResponse:(NSURLResponse *)response
|
||||||
|
data:(NSData *)data
|
||||||
|
error:(NSError *__autoreleasing *)error
|
||||||
|
{
|
||||||
|
id JSONObject = [super responseObjectForResponse:response data:data error:error];
|
||||||
|
NSHTTPURLResponse *currentResponse = (NSHTTPURLResponse*)response;
|
||||||
|
|
||||||
|
if (*error != nil) {
|
||||||
|
NSData *errorData = [[(*error).userInfo mutableCopy] objectForKey:AFNetworkingOperationFailingURLResponseDataErrorKey];
|
||||||
|
NSMutableDictionary *userInfo = [NSJSONSerialization JSONObjectWithData: errorData options:kNilOptions error:nil];;
|
||||||
|
|
||||||
|
NSError *newError = [NSError errorWithDomain:(*error).domain code:currentResponse.statusCode userInfo:userInfo];
|
||||||
|
(*error) = newError;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (JSONObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Loading…
x
Reference in New Issue
Block a user