在基于 Cordova 的 Salesforce 混合应用程序中找不到 SFLoginViewController?

SFLoginViewController not found in Cordova based Salesforce Hybrid apps?

我对 Salesforce Hybrid 应用程序有点陌生。

最近,我更新了 Salesforce 移动 SDK。

但是,当 运行 在 IOS 模拟器上时,Salesforce Mobile SDK 添加了一个用于更改服务器的附加导航栏。

我想删除那个栏。

我尝试了什么:

我尝试了下面描述的步骤link

https://developer.salesforce.com/docs/atlas.en-us.noversion.mobile_sdk.meta/mobile_sdk/oauth_hide_gear_icon.htm

但是,这给了我一个错误:

Receiver 'SFLoginViewController' for class message is a forward declaration

感谢任何帮助

提前致谢

"SFLoginViewController"

中有一个 属性 用于隐藏导航栏和设置按钮

您需要在 appDelegate.m 主文件的 init 方法中编写以下代码,如果没有该方法,您可能需要添加 init 方法。

[[SFLoginViewController sharedInstance] setShowSettingsIcon:FALSE];
[[SFLoginViewController sharedInstance] setShowNavbar:NO];

不要忘记在 appDelegate.m

中导入 "SFLoginViewController.h"

但是现在您已经提到 "SFLoginViewController.h" 在您的项目中不可用,您只需创建名称为 SFLoginViewController 的新文件并在该文件中添加以下代码:

/** The Salesforce login screen view.
 */
@interface SFLoginViewController : UIViewController

/** Returns a shared singleton of `SFLoginViewController` class.
 */
+(_Nonnull instancetype)sharedInstance;

/**
 * Outlet to the OAuth web view.
 */
@property (nonatomic, strong, nullable) IBOutlet UIView* oauthView;

/** Specify the font to use for navigation bar header text.*/
@property (nonatomic, strong, nullable) UIFont * navBarFont;

/** Specify the text color to use for navigation bar header text. */
@property (nonatomic, strong, nullable) UIColor * navBarTextColor;

/** Specify navigation bar color. This color will be used by the login view header.
 */
@property (nonatomic, strong, nullable) UIColor *navBarColor;

/** Specify visibility of nav bar. This property will be used to hide/show the nav bar*/
@property (nonatomic) BOOL showNavbar;

/** Specifiy the visibility of the settings icon. This property will be used to hide/show the settings icon*/
@property (nonatomic) BOOL showSettingsIcon;

/** Applies the view's style attributes to the given navigation bar.
 @param navigationBar The navigation bar that the style is applied to.
 */
- (void)styleNavigationBar:(nullable UINavigationBar *)navigationBar;
@end

希望对您有所帮助!