forcedotcom / SalesforceMobileSDK-CordovaPlugin

Cordova plugin for the Salesforce Mobile SDK
Other
47 stars 114 forks source link

Custom login host not listed in login hosts settings #191

Closed sevem closed 7 years ago

sevem commented 8 years ago

I have a problem with the custom login host in my hybrid app on iOS. In my plist file I've defined a custom login host

<key>SFDCOAuthLoginHost</key>
<string>mycustomhost.my.salesforce.com</string>

Behaviour in unstable branch 4.2.0 If I install and start the app for the first time, the correct login of my custom host is show. If I now click on the settings icon to open the host choose connection setting without selecting e.g. the Production server, just open the the settings view, the app crashes with this stacktrace

May 13 12:17:29 localhost [71518]: INFO|SFAuthenticationManager|Cancel authentication called.  App is currently authenticating.
May 13 12:17:29 localhost [71518]: INFO|SFSecurityLockout|App requested passcode screen cancel.  Screen is not displayed.
May 13 12:17:30 localhost [71518]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <UINavigationController: 0x795f6000>.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x00928494 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x04527e02 objc_exception_throw + 50
        2   UIKit                               0x00ea6385 -[UIViewController _presentViewController:withAnimationController:completion:] + 5682
        3   UIKit                               0x00ea946f __62-[UIViewController presentViewController:animated:completion:]_block_invoke_2 + 88
        4   UIKit                               0x00d84db2 +[UIView(Animation) performWithoutAnimation:] + 82
        5   UIKit                               0x00d84dfb +[UIView(Animation) _performWithoutAnimation:] + 40
        6   UIKit                               0x00ea9379 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 247
        7   UIKit                               0x00ea9768 __65-[UIViewController _performCoordinatedPresentOrDismiss:animated:]_block_invoke + 18
        8   UIKit                               0x0183a2d2 -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 292
        9   UIKit                               0x01835f86 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 147
        10  UIKit                               0x01835c71 -[_UIViewControllerTransitionContext completeTransition:] + 136
        11  UIKit                               0x01860b34 -[UIViewControllerBuiltinTransitionViewAnimator transitionViewDidComplete:fromView:toView:removeFromView:] + 74
        12  UIKit                               0x00e5848a -[UITransitionView notifyDidCompleteTransition:] + 280
        13  UIKit                               0x00e58176 -[UITransitionView _didCompleteTransition:] + 1550
        14  UIKit                               0x00e5adb1 -[UITransitionView _transitionDidStop:finished:] + 121
        15  UIKit                               0x00d5f08f -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 247
        16  UIKit                               0x00d5f485 -[UIViewAnimationState animationDidStop:finished:] + 90
        17  QuartzCore                          0x03a7368b _ZN2CA5Layer23run_animation_callbacksEPv + 305
        18  libdispatch.dylib                   0x04e866ed _dispatch_client_callout + 14
        19  libdispatch.dylib                   0x04e6f286 _dispatch_main_queue_callback_4CF + 689
        20  CoreFoundation                      0x008721be __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
        21  CoreFoundation                      0x00830434 __CFRunLoopRun + 2356
        22  CoreFoundation                      0x0082f846 CFRunLoopRunSpecific + 470
        23  CoreFoundation                      0x0082f65b CFRunLoopRunInMode + 123
        24  GraphicsServices                    0x05e58664 GSEventRunModal + 192
        25  GraphicsServices                    0x05e584a1 GSEventRun + 104
        26  UIKit                               0x00cc0eb9 UIApplicationMain + 160
        27  Conference                          0x000d4d19 main + 89
        28  libdyld.dylib                       0x04eaba25 start + 1
    )
May 13 12:17:30 localhost SpringBoard[70843]: HW kbd: Failed to set (null) as keyboard focus

After restart the app, the Production Server is selected and I have no chance to select my custom login host because the host is not listed in the server selection

Behaviour in v4.1.2 If I install and start the app for the first time, the correct login of my custom host is show. If I now click on the settings icon to open the host choose connection setting without selecting e.g. the Production server, just open the the settings view, the selection view is closed and the Production server is selected. Than I have no chance to select my custom login host again because the host is not listed in the server selection

My environment:

bhariharan commented 8 years ago

@sevem I'll take a look.

sevem commented 8 years ago

@bhariharan any updates here? Can you estimate until when a solution will be available? We have currently a lot of customer projects which are depending on this issue

bhariharan commented 8 years ago

@sevem I've made some fixes in this area on unstable. Could you try the latest from unstable and let me know if the issue still exists?

sevem commented 8 years ago

@bhariharan Unfortunately the issue still exists. Exactly same behaviour as described

sevem commented 7 years ago

@bhariharan go live is getting closer. And I think it is not really a good idea to go live with this problem. Any news about this issue?

fnijenhuis commented 7 years ago

I have the same problem. Custom login page shows on iOS (and works fine), but as soon as the user clicks the settings icon in the top right corner, the production login page pops up and the user cannot get the custom login page back. Only thing that works is to delete the app and install it again.

helenren commented 7 years ago

@sevem , just tried against the latest code on unstable, cannot repro your issue on our side. I use the same version for platform: 9.3.2 and cordova: 6.1.1. Could you please have another try with our latest bit. Could you please also try to add the same host via the UI from the settings. For both of ways, cannot repro your issue.

Here is the more instruction:

1.Start the app without logging in. 2.In the login screen, click the configuration button in the upper right corner. 3.In the Choose Connection screen, click the plus sign (+).

  1. In the Add Connection screen, you can enter an optional label to help you identify the configuration.
  2. Enter your custom login host’s URI. Be sure to omit the https:// prefix. For example, here’s how you enter a typical community URL:mycommunity-developer-edition.na15.force.com/fineapps
helenren commented 7 years ago

@fnijenhuis could you please have another try as well using the above instruction.Thanks!

huminzhi commented 7 years ago

The issue is fixed in build:MobileSDK.iOS.4.2

sevem commented 7 years ago

@huminzhi unfortunately not completely fixed. Yes I can add a custom login host and yes I can switch between my custom host and e.g. the production. But .... I've defined a SFDCOAuthLoginHost in my plist file. And I would expect that this SFDCOAuthLoginHost is also listed in the host selection like the production or sandbox host. And my SFDCOAuthLoginHost is not used as the default host.

bildschirmfoto 2016-07-07 um 14 58 58

sevem commented 7 years ago

@huminzhi sorry. I was not completely right. My custom login host is used for the very first start of the app. But if I click on the settings menu to open the choose connection dialog, the dialog opens for a short time and closes automatically. The Production host is selected the. When I open the dialog again, my custom login host is not listed in available host list.

As a user I would expect that a custom login host is listed here if one is defined

I'm using the latest unstable branch

sevem commented 7 years ago

@huminzhi Shame on me. Sorry. I didn't know that the latest binaries are not included in the unstable branch. Got a hit vom @wmathurin. Thanks for that. Problem is fixed!