• Gaurav Thakur
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am creating the iOS Native app in which I am customizing the Login page to look like Salesforce1 iOS app page. It also includes a Settings button which allows user to switch to a different endpoint URL using a dropdown.

I was successful in creating a cutomized page, loading the Login screen and authenticating the user.
 
My problem is that when I switch the endpoint URL to say Sandbox(by default the app is pointing to Production), using the Settings dropdown using the below code.
[[SFUserAccountManager sharedInstance] setLoginHost:loginHost];
and reload the UIWebView Login page again using the below code, it does not set the endpoint that I had selected from the dropdown.
SFAuthenticationViewHandler *authHandler = [[SFAuthenticationViewHandler alloc]
                                                initWithDisplayBlock:^(SFAuthenticationManager *authManager, UIWebView *authWebView) {
                                                    //authController is the custom ViewContoller which has the UIWebView and in this block I am asigning the webview recevied from the SFDC SDK.
                                                    authController.authViewCompleted = NO;
                                                    authController.authWebView = authWebView;
                                                    authWebView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
                                                    authWebView.frame = authController.webViewHolder.bounds;
                                                    [rootViewController presentViewController:authController animated:TRUE completion:nil];
                                                } dismissBlock:^(SFAuthenticationManager *authViewManager) {
                                                    authController.authViewCompleted = TRUE;
                                                    [authController dismissViewControllerAnimated:TRUE completion:nil];
                                                }];
    
    _notificationNameDictionary = @{kSFUserLogoutNotification : kPSSUserLogoutNotification,
                                    kSFUserLoggedInNotification : kPSSUserLoggedInNotification,
                                    kSFLoginHostChangedNotification : kPSSLoginHostChangedNotification};
    
    self.authManager.authViewHandler = authHandler;
    [self.authManager loginWithCompletion:completionBlock failure:failureBlock];

I know for sure that the Sandbox endpoint is set, because when I kill the app and reopen it then the Login Page is loading the Sandbox login page.

I want to know how would I be able to replicate the Settings behavior to take the Sandbox endpoint at runtime, and not the Production endpoint(default one) without letting the user to kill the application.







 
I'm showing Salesforce login screen in my iOS native application after loading my root view, but their login screen (WebView) is covering my entire screen and I'm not able to show the status bar and navigation bar at top side. I have written code in willDisplayAuthWebView method as mentioned below
- (void)authManager:(SFAuthenticationManager *)manager willDisplayAuthWebView:(UIWebView *)view{ 
CGRect newFrame = self.view.frame; 
newFrame.origin.y += 64;
view.frame = newFrame;
[Self.View addSubview:view]; 
}
and the screen shot is here
User-added image

but no luck. Is there anyway to handle this issue. Please help me. Thanks in advance.