2017-09-26 1 views
0

새 버전 5.3.0으로 salesforcesdk-ios를 업데이트했습니다. authInfo : oauthCoordinatorDidAuthenticate - 성공적으로 로그인 한 후,이 위임에 모든 값을 설정 이 같은,SFUserAccount는 항상 0입니다.

- (void) oauthCoordinatorDidAuthenticate: (SFOAuthCoordinator *) coordinator authInfo:(SFOAuthInfo *)info { 

    [SFAuthenticationManager sharedManager].coordinator = coordinator; 
    [[SFAuthenticationManager sharedManager] coordinator].credentials = coordinator.credentials; 
    [[SFUserAccountManager sharedInstance] applyCredentials:coordinator.credentials]; 
} 

나는 refreshtoken currentUser에 대한 유효성을 검사하려고 무기 호입니다 - (무효) 전송 : (SFRestRequest를 *) delegate 요청 : (id) delegate shouldRetry : (BOOL) shouldRetry 및 Salesforce로 요청을 보내지 않고 salesforce login 페이지를 항상로드합니다.

// 증명할 수있는 인증 정보가없는 경우 보내기 전에 로그인하십시오. SFUserAccount * user = [SFUserAccountManager sharedInstance] .currentUser;

사용자는 항상 nil입니다. useraccount를 올바르게 설정하는 방법은 무엇입니까? 감사!

답변

0

우선, 위임을 확인할 수 있다고 생각합니다 oauthCoordinatorDidAuthenticate : authInfo :이 작동합니다. 같은 :

- (void) oauthCoordinatorDidAuthenticate: (SFOAuthCoordinator *) coordinator authInfo:(SFOAuthInfo *)info { 
print("delegate is worked") 
[SFAuthenticationManager sharedManager].coordinator = coordinator; 
[[SFAuthenticationManager sharedManager] coordinator].credentials = coordinator.credentials; 
[[SFUserAccountManager sharedInstance] applyCredentials:coordinator.credentials]; 

}

그것은 사용자가 전무하다 일으킬 수, 대리인은 일을하지 않을 때.

+0

이 대리인이 호출되었지만 useraccount가 올바르게 설정되지 않았습니다. –

0

답변을 찾았습니다. 그들은 iOS SDK의 최신 버전에서 currentUser를 명시 적으로 설정하려고합니다. 샌드 박스와 프로덕션간에 전환 할 토글이있는 사용자 정의 로그인 화면이 있습니다. 이 방법으로 사용자 계정을 지금 설정하고 있습니다. -

[[SFAuthenticationManager sharedManager] loginWithCompletion:^(SFOAuthInfo *authInfo,SFUserAccount *userAccount) { 
     [SFSDKCoreLogger i:[self class] format:@"Authentication (%@) succeeded. Launch completed.", authInfo.authTypeDescription]; 
     [SFUserAccountManager sharedInstance].currentUser = userAccount; 
     [SFSecurityLockout setupTimer]; 
     [SFSecurityLockout startActivityMonitoring]; 
     s_loggedIn = YES; 
    } failure:^(SFOAuthInfo *authInfo, NSError *authError) { 
     [SFSDKCoreLogger e:[self class] format:@"Authentication (%@) failed: %@.", (authInfo.authType == SFOAuthTypeUserAgent ? @"User Agent" : @"Refresh"), [authError localizedDescription]]; 
    }];