简体   繁体   English

是否可以通过设备设置(例如,facebook应用程序在iOS中的操作)登录到我们的应用程序

[英]Is there any possiblility to login to our app from device settings like what facebook app does in iOS

I need a confirmation that is it possible to login to my own app by giving the credentials in the settings of the device. 我需要确认,可以通过在设备设置中提供凭据来登录自己的应用程序。

flow is like: settings -> tap onto my app -> enter username, password and version -> tap home button ->tap on my app -> then it should show the homescreen instead login screen. 流程如下:设置->点击我的应用程序->输入用户名,密码和版本->点击主页按钮->点击我的应用程序->然后它应该显示主屏幕而不是登录屏幕。

For ex: The Facebook app works same as we can enter the credentials and signedin in the device settings and when we trap on to the facebook app it automatically sign in. 例如:Facebook应用程序的工作原理与我们可以在设备设置中输入凭据和登录一样,当我们陷入Facebook应用程序时,它会自动登录。

I need confirmation whether its possible or not 我需要确认是否可能

It is possible, but not a good idea. 可能,但不是个好主意。

However here are the implementation steps.. 但是,这里是实现步骤。

Implement an iOS Settings Bundle with two text feilds such as user name and password. 使用两个文本字段(例如用户名和密码)实现iOS设置捆绑包

In AppDelegate didFinishLaunchingWithOptions , retreive this details and do it whatever you need. 在AppDelegate didFinishLaunchingWithOptions ,检索此详细信息,然后根据需要进行操作。

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

 NSUserDefaults * standardUserDefaults = [NSUserDefaults standardUserDefaults];
 NSString *userName = [standardUserDefaults objectForKey:@"userName"];

 NSUserDefaults * pswd = [NSUserDefaults standardUserDefaults];
 NSString *userName = [standardUserDefaults objectForKey:@"password"];

 if (userName == expectedUsername && pswd == expectedPswd) {

    //load the home screen
 }
 else
 {
    //load the login screen
 }
}

To implement a settings bundle, please read this link 要实施设置包,请阅读此链接

嘿monish kumar,该URL可以帮助您http://as.wiley.com/WileyCDA/WileyTitle/productCd-1118144252.html此URL链接至本书,第9章介绍了如何实现它,还提供了代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM