From 99ad2b456b3086a815d23504e65f4cfd4957ffed Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Tue, 3 Jan 2017 12:24:46 +0100 Subject: [PATCH] - Fix Crash in SetEnvironment --- Example/PNObject/PNObjAppDelegate.m | 1 + PNObject/Classes/PNObjectConfig.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/PNObject/PNObjAppDelegate.m b/Example/PNObject/PNObjAppDelegate.m index 3ce6668..cdbdcff 100644 --- a/Example/PNObject/PNObjAppDelegate.m +++ b/Example/PNObject/PNObjAppDelegate.m @@ -52,6 +52,7 @@ [[PNObjectConfig sharedInstance] setOauthUserName:@"admin" oauthPassword:@"admin" forEnv:EnvironmentStage]; + [[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage]; //[[PNObjectConfig sharedInstance] setHTTPHeaderValue:@"XMLHttpRequest" forKey:@"X-Request-With"]; diff --git a/PNObject/Classes/PNObjectConfig.m b/PNObject/Classes/PNObjectConfig.m index 98bbc8a..d8858db 100644 --- a/PNObject/Classes/PNObjectConfig.m +++ b/PNObject/Classes/PNObjectConfig.m @@ -219,7 +219,7 @@ static bool isFirstAccess = YES; _currentEndPointBaseUrl = [[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl]; _currentOAuthClientID = [[_configuration objectForKey:_currentEnv] objectForKey:Client_ID]; _currentOAuthClientSecret = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Secret]; - if ([[_configuration objectForKey:_currentEnv] containsValueForKey:Client_Username] && [[_configuration objectForKey:_currentEnv] containsValueForKey:Client_Password]) { + if ([[_configuration objectForKey:_currentEnv] objectForKey:Client_Username] && [[_configuration objectForKey:_currentEnv] objectForKey:Client_Password]) { _currentOAuthUserName = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Username]; _currentOAuthPassword = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Password]; }