- Fix
This commit is contained in:
parent
00fd4d3748
commit
d2739bce5c
@ -19,53 +19,43 @@
|
|||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
|
|
||||||
|
|
||||||
[PNObjectConfig initSharedInstanceForEnvironments:@{EnvironmentDevelopment : @"http://packman.local/app_dev.php/api/v1/",
|
|
||||||
EnvironmentStage : @"http://packman.ppreview.it/app_stage.php/api/v1/",
|
|
||||||
EnvironmentProduction : @"http://packman.ppreview.it/app_stage.php/api/v1/"
|
|
||||||
} withOauth:YES];
|
|
||||||
[[PNObjectConfig sharedInstance] setHTTPHeaderValue:@"application/x-www-form-urlencoded" forKey:@"Content-Type"];
|
|
||||||
[[PNObjectConfig sharedInstance] setClientID:@"1_pqjo2w5k7j4g8skco408oc048w8so0ws840gcg8k8gwsgk0g4" clientSecret:@"10w0vg2v6eggooc4wks4w4s0wkwok0wkck0w888so0o80g88w8" forEnv:Stage];
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setEnvironment:Stage];
|
|
||||||
|
|
||||||
#endif
|
[PNObjectConfig initSharedInstanceForEnvironments:@{ EnvironmentDevelopment : @"https://development.it/api/v1",
|
||||||
|
EnvironmentStage : @"https://stage.it/api/v1",
|
||||||
|
EnvironmentProduction : @"https://pnobject.giuseppenucifora.com/"
|
||||||
|
} withOauth:NO];
|
||||||
|
|
||||||
/*[PNObjectConfig initSharedInstanceForEnvironments:@{ EnvironmentDevelopment : @"https://development.it/api/v1",
|
[[PNObjectConfig sharedInstance] setEnvironment:Production];
|
||||||
EnvironmentStage : @"https://stage.it/api/v1",
|
|
||||||
EnvironmentProduction : @"https://pnobject.giuseppenucifora.com/"
|
//[[[PNObjectConfig sharedInstance] manager] setSecurityPolicy:[AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]];
|
||||||
}];
|
//[[PNObjectConfig sharedInstance] manager].securityPolicy.allowInvalidCertificates = YES;
|
||||||
|
|
||||||
[[PNObjectConfig sharedInstance] setEnvironment:Production];
|
//[PNObject get];
|
||||||
|
|
||||||
//[[[PNObjectConfig sharedInstance] manager] setSecurityPolicy:[AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]];
|
PNUser *user = [PNUser currentUser];
|
||||||
//[[PNObjectConfig sharedInstance] manager].securityPolicy.allowInvalidCertificates = YES;
|
|
||||||
|
//NSLog(@"user : %@",[user getJSONObject]);
|
||||||
//[PNObject get];
|
|
||||||
|
//[user autoRemoveLocally];
|
||||||
PNUser *user = [PNUser currentUser];
|
[user setFirstName:@"Giuseppe2"];
|
||||||
|
[user setLastName:@"Nucifora2"];
|
||||||
//NSLog(@"user : %@",[user getJSONObject]);
|
[user setEmail:@"giuseppe.nucifora@giuseppenucifora.com"];
|
||||||
|
[user setSex:@"M"];
|
||||||
//[user autoRemoveLocally];
|
[user setHasAcceptedNewsletter:NO];
|
||||||
[user setFirstName:@"Giuseppe2"];
|
[user setHasAcceptedPrivacy:YES];
|
||||||
[user setLastName:@"Nucifora2"];
|
[user setUsername:@"giuseppe.nucifora"];
|
||||||
[user setEmail:@"giuseppe.nucifora@giuseppenucifora.com"];
|
[user setPassword:@"giuseppe.nucifora.password"];
|
||||||
[user setSex:@"M"];
|
[user setPhone:@"+393485904995"];
|
||||||
[user setHasAcceptedNewsletter:NO];
|
[user setUserId:@"blablabla"];
|
||||||
[user setHasAcceptedPrivacy:YES];
|
[user saveLocally];
|
||||||
[user setUsername:@"giuseppe.nucifora"];
|
|
||||||
[user setPassword:@"giuseppe.nucifora.password"];
|
|
||||||
[user setPhone:@"+393485904995"];
|
|
||||||
[user setUserId:@"blablabla"];
|
[user setFirstName:@"Angela"];
|
||||||
[user saveLocally];
|
[user setLastName:@"Sapienza"];
|
||||||
|
|
||||||
|
[user JSONObject];
|
||||||
|
|
||||||
[user setFirstName:@"Angela"];
|
|
||||||
[user setLastName:@"Sapienza"];
|
|
||||||
|
|
||||||
[user getJSONObject];*/
|
|
||||||
|
|
||||||
|
|
||||||
/*[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingString:[PNAccessToken PNObjEndPoint]] parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
|
/*[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingString:[PNAccessToken PNObjEndPoint]] parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
|
||||||
|
|||||||
@ -224,8 +224,8 @@ static bool isFirstAccess = YES;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) tryRefreshToken {
|
- (void) tryRefreshToken {
|
||||||
if (![PNUser currentUser]) {
|
if ([PNUser currentUser]) {
|
||||||
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:[[PNUser currentUser] username] password:[[PNUser currentUser] password] scope:kAFOAuthPasswordCredentialsGrantType success:^(AFOAuthCredential * _Nonnull credential) {
|
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:[[PNUser currentUser] username] password:[[PNUser currentUser] password] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||||
_currentOauthCredential = credential;
|
_currentOauthCredential = credential;
|
||||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||||
} failure:^(NSError * _Nonnull error) {
|
} failure:^(NSError * _Nonnull error) {
|
||||||
@ -234,7 +234,7 @@ static bool isFirstAccess = YES;
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] scope:kAFOAuthClientCredentialsGrantType success:^(AFOAuthCredential * _Nonnull credential) {
|
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||||
_currentOauthCredential = credential;
|
_currentOauthCredential = credential;
|
||||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||||
} failure:^(NSError * _Nonnull error) {
|
} failure:^(NSError * _Nonnull error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user