2013-02-14 103 views
0

我正在使用來自here的zksforce SDK。 每當我開始我的應用程序,它顯示我的登錄表單。取而代之,我只想保持登錄會話,直到用戶註銷。 這可能嗎?我應該怎麼做?以下是我的代碼,顯示salesforce的登錄表單。Salesforce登錄

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 
    sectionViewController = [[SFT1SectionViewController alloc] init]; 
    oAuthViewController = [[FDCOAuthViewController alloc] initWithTarget:sectionViewController selector:@selector(loginOAuth:error:) clientId:kSFOAuthConsumerKey]; 
    oAuthViewController.modalPresentationStyle = UIModalPresentationFormSheet; 
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:oAuthViewController]; 
    self.window.rootViewController = self.navigationController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

我也嘗試了自定義登錄使用loginWithUsername:密碼:方法,但它給了我令牌錯誤,說我應該使用密碼令牌一起附加的安全性。那是什麼意思?我正在使用以下行呼叫方法:

[[FDCServerSwitchboard switchboard] loginWithUsername:usernameTextField.text password:passwordTextField.text target:rootViewController selector:@selector(loginResult:error:)]; 

此問題也可以通過在用戶使用web視圖登錄時保存密碼來解決。是否可以保存這樣的密碼?如果是,如何?

+0

我沒有看到任何Objective-C++代碼。重新標記。 – vikingosegundo 2013-05-14 20:24:43

回答

0
NSString *password = @"Your password here"; 
NSString *token = @"your token here"; 
NSString *passwordToken = [NSString stringWithFormat:@"%@%@", password, token]; 
[[FDCServerSwitchboard switchboard] loginWithUsername:username password:passwordToken target:self selector:@selector(loginResult:error:)]; 

這會怎麼做。如果您忘記了令牌,則可以重置並將令牌發送到您的電子郵件。您可以通過設置 - >個人信息 - >重置令牌來完成此操作。