diff --git a/Example/Podfile.lock b/Example/Podfile.lock
index 099b882..28effad 100644
--- a/Example/Podfile.lock
+++ b/Example/Podfile.lock
@@ -40,7 +40,7 @@ PODS:
- NSString-Helper (1.0.3)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- - PNObject (0.3.13):
+ - PNObject (0.3.14):
- AFNetworking
- CodFis-Helper
- FBSDKCoreKit
@@ -96,7 +96,7 @@ SPEC CHECKSUMS:
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
- PNObject: 7e0d02a6de46f9b8d72859bee9088c260c5ae078
+ PNObject: cf403a77375ff20dba304d04eb79892fdae3d54d
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
diff --git a/Example/Pods/Local Podspecs/PNObject.podspec.json b/Example/Pods/Local Podspecs/PNObject.podspec.json
index f4fa823..1f5d1c8 100644
--- a/Example/Pods/Local Podspecs/PNObject.podspec.json
+++ b/Example/Pods/Local Podspecs/PNObject.podspec.json
@@ -1,6 +1,6 @@
{
"name": "PNObject",
- "version": "0.3.13",
+ "version": "0.3.14",
"summary": "PNObject is a simple replica of the more complex ParseObject",
"homepage": "https://github.com/giuseppenucifora/PNObject",
"license": "MIT",
@@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/giuseppenucifora/PNObject.git",
- "tag": "0.3.13"
+ "tag": "0.3.14"
},
"platforms": {
"ios": "7.0"
diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock
index 099b882..28effad 100644
--- a/Example/Pods/Manifest.lock
+++ b/Example/Pods/Manifest.lock
@@ -40,7 +40,7 @@ PODS:
- NSString-Helper (1.0.3)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- - PNObject (0.3.13):
+ - PNObject (0.3.14):
- AFNetworking
- CodFis-Helper
- FBSDKCoreKit
@@ -96,7 +96,7 @@ SPEC CHECKSUMS:
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
- PNObject: 7e0d02a6de46f9b8d72859bee9088c260c5ae078
+ PNObject: cf403a77375ff20dba304d04eb79892fdae3d54d
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
diff --git a/Example/Pods/Target Support Files/PNObject/Info.plist b/Example/Pods/Target Support Files/PNObject/Info.plist
index 1000bf8..965ba81 100644
--- a/Example/Pods/Target Support Files/PNObject/Info.plist
+++ b/Example/Pods/Target Support Files/PNObject/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.3.13
+ 0.3.14
CFBundleSignature
????
CFBundleVersion
diff --git a/Example/Pods/Target Support Files/PNObject/ResourceBundle-PNObject-Info.plist b/Example/Pods/Target Support Files/PNObject/ResourceBundle-PNObject-Info.plist
index 12c163f..f183ce7 100644
--- a/Example/Pods/Target Support Files/PNObject/ResourceBundle-PNObject-Info.plist
+++ b/Example/Pods/Target Support Files/PNObject/ResourceBundle-PNObject-Info.plist
@@ -13,7 +13,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.3.13
+ 0.3.14
CFBundleSignature
????
CFBundleVersion
diff --git a/PNObject.podspec b/PNObject.podspec
index aa32693..0afa461 100644
--- a/PNObject.podspec
+++ b/PNObject.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "PNObject"
-s.version = "0.3.13"
+s.version = "0.3.14"
s.summary = "PNObject is a simple replica of the more complex ParseObject"
# This description is used to generate tags and improve search results.
diff --git a/Pod/Classes/PNObject+PNObjectConnection.m b/Pod/Classes/PNObject+PNObjectConnection.m
index 1b60c9a..40da60a 100644
--- a/Pod/Classes/PNObject+PNObjectConnection.m
+++ b/Pod/Classes/PNObject+PNObjectConnection.m
@@ -32,7 +32,7 @@
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
-
+ [[[PNObjectConfig sharedInstance] manager] setRequestSerializer:[[PNObjectConfig sharedInstance] jsonSerializer]];
[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:downloadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
if (success) {
diff --git a/Pod/Classes/PNObjectConfig.h b/Pod/Classes/PNObjectConfig.h
index 7b981b0..ee38882 100644
--- a/Pod/Classes/PNObjectConfig.h
+++ b/Pod/Classes/PNObjectConfig.h
@@ -184,11 +184,22 @@ extern NSString* _Nonnull const Client_Secret;
///--------------------------------------
#pragma mark - PNObjectConfig Properties
///--------------------------------------
+
/**
* <#Description#>
*/
@property (nonatomic, strong, nonnull) AFOAuth2Manager *manager;
+/**
+ * <#Description#>
+ */
+@property (nonatomic, strong, readonly, nonnull) AFJSONRequestSerializer *jsonSerializer;
+
+/**
+ * <#Description#>
+ */
+@property (nonatomic, strong, readonly, nonnull) AFHTTPRequestSerializer *httpSerializer;
+
/**
* <#Description#>
*/
diff --git a/Pod/Classes/PNObjectConfig.m b/Pod/Classes/PNObjectConfig.m
index d61e676..a0dbd42 100644
--- a/Pod/Classes/PNObjectConfig.m
+++ b/Pod/Classes/PNObjectConfig.m
@@ -153,6 +153,9 @@ static bool isFirstAccess = YES;
_configuration = [[NSMutableDictionary alloc] init];
_minPasswordLenght = minPassLenght;
+ _jsonSerializer = [AFJSONRequestSerializer serializer];
+ _httpSerializer = [AFHTTPRequestSerializer serializer];
+
_headerFields = [[NSMutableDictionary alloc] init];
if ([[NSUserDefaults standardUserDefaults] objectForKey:PNObjectEncryptionKey]) {
@@ -217,13 +220,15 @@ static bool isFirstAccess = YES;
for (NSString *key in [_headerFields allKeys]) {
- [[_manager requestSerializer] setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
+ [_httpSerializer setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
+ [_jsonSerializer setValue:[_headerFields objectForKey:key] forHTTPHeaderField:key];
}
if (canTryRefreh) {
if (_currentOauthCredential && ![_currentOauthCredential isExpired]) {
- [[_manager requestSerializer] setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
}
else {
[self refreshToken];
@@ -262,11 +267,14 @@ static bool isFirstAccess = YES;
failure:(nullable void (^)(NSError * _Nonnull error))failure {
if([SINGLETON.userSubClass currentUser] && [[SINGLETON.userSubClass currentUser] hasValidEmailAndPasswordData]) {
+ [_manager setRequestSerializer:_httpSerializer];
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:[[SINGLETON.userSubClass currentUser] email] password:[[(PNUser*)[SINGLETON.userSubClass currentUser] password] password] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
_currentOauthCredential = credential;
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceCredentialIdentifier];
- [_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ //[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
if (success) {
success(YES);
@@ -307,11 +315,14 @@ static bool isFirstAccess = YES;
return;
}
}
+ [_manager setRequestSerializer:_httpSerializer];
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:email password:password scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
_currentOauthCredential = credential;
[AFOAuthCredential storeCredential:_currentOauthCredential withIdentifier:PNObjectServiceCredentialIdentifier];
- [_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ //[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_httpSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
+ [_jsonSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
if (success) {
success(YES);
@@ -333,6 +344,7 @@ static bool isFirstAccess = YES;
- (void) refreshTokenForClientCredentialWithBlockSuccess:(nullable void (^)(BOOL refreshSuccess))success
failure:(nullable void (^)(NSError * _Nonnull error))failure {
+ [_manager setRequestSerializer:_httpSerializer];
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
_currentOauthCredential = credential;