Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Couchbase服务器到iOS手机_Ios_Couchbase_Couchbase Lite_Couchbase Sync Gateway - Fatal编程技术网

Couchbase服务器到iOS手机

Couchbase服务器到iOS手机,ios,couchbase,couchbase-lite,couchbase-sync-gateway,Ios,Couchbase,Couchbase Lite,Couchbase Sync Gateway,我正在开发一个iOS应用程序 对于实现登录模块(用户名/密码、注册和忘记密码)有点困惑 刚到Couchbase。使用Couchbase企业版“http://192.168.1.126:8091/ui/index.html#/overview“在Xcode中设置Couchbase Lite,我不知道下一步是什么。有人知道吗 数据建模:JSON文档 User ("Set as the EMAIL ID") { _id:” ", username::" ", password

我正在开发一个iOS应用程序

对于实现登录模块(用户名/密码、注册和忘记密码)有点困惑

刚到Couchbase。使用Couchbase企业版
“http://192.168.1.126:8091/ui/index.html#/overview“
在Xcode中设置Couchbase Lite,我不知道下一步是什么。有人知道吗

数据建模:JSON文档

User ("Set as the EMAIL ID")
{ 
    _id:” ",
    username::" ",
    password::" ",
    email::" ", 
    type:"user"
}
用户信息(“设置为电子邮件ID”)


可以在同步网关配置文件中创建用户,如下所示:

{
“数据库”:{
“应用程序”:{
“水桶”:“海象”,
“用户”:{
“john”:{“password”:“pass”}
}
}
}
}
然后,将为此用户启用iOS应用程序中的身份验证:

let manager=CBLManager.sharedInstance()
让数据库=试试!manager.DatabaseName(“应用程序”)
让url=NSURL(字符串:http://localhost:4984/app")!
让push=database.createPushReplication(url)
让pull=database.createPullReplication(url)
push.authenticator=CBLAuthenticator.basicAuthenticatorWithName(“john”,密码:“pass”)
pull.authenticator=CBLAuthenticator.basicAuthenticatorWithName(“john”,密码:“pass”)
push.start()
pull.start()
对于用户注册,您需要设置应用服务器,以便在同步网关管理端口(默认为4985)上注册用户。要注册用户,请执行以下操作:

$ curl -vX POST -H 'Content-Type: application/json' \
       -d '{"name": "user2", "password": "pass"}' \
       :4985/app/_user/
对于忘记密码功能,应用程序服务器应使用新密码更新用户记录:

$ curl -vX PUT -H 'Content-Type: application/json' \
             -d '{"name": "user2", "password": "newpass"}' \
             :4985/app/_user/user2

你看过示例应用程序了吗?这是一个很好的方法来熟悉事情的运作方式。。。我会试试这个:)帮了大忙@但是如何在目标C中实现呢?帮了大忙。提前感谢:)@jamiltz@AnneBernadette与Switft实现几乎完全相同…只需将CBLManager.sharedInstance()与[CBLManager sharedInstance]等切换。
$ curl -vX PUT -H 'Content-Type: application/json' \
             -d '{"name": "user2", "password": "newpass"}' \
             :4985/app/_user/user2